How to use shared library from Android on Raspberry Pi

282 Views Asked by At

I have closed-source shared library originally built for Android which I want to use on Raspberry Pi. The problem is this:

/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `__cxa_atexit@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `calloc@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `malloc@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `free@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `memset@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `memcpy@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `raise@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `__cxa_finalize@LIBC'
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `abort@LIBC'

This is most likely because there's no such symbols in glibc.

The simplest solution would (probably) be to create wrapper library with these functions which will just call glibc's ones. However, it's not clear how to create functions with @ in the middle of their names.

Other solution may be somehow modifying the libfoo.so itself (I tried replacing libc.so requirement to libc.so.6 using patchelf without any success).

Probably the best option (but the hardest and it will require much more work) will be reverse-engineering this library. I will probably do this in future, but for now I need simple solution which just works.

What should I do to make it work?

0

There are 0 best solutions below