0

我有一个最初为 Android 构建的闭源共享库,我想在 Raspberry Pi 上使用它。问题是这样的:

/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'

这很可能是因为 glibc 中没有这样的符号。

最简单的解决方案(可能)是使用这些函数创建包装库,这些函数只会调用 glibc 的函数。但是,尚不清楚如何在名称中间使用 @ 创建函数。

其他解决方案可能会以某种方式修改 libfoo.so 本身(我尝试使用 patchelf 将 libc.so 要求替换为 libc.so.6 但没有任何成功)。

可能最好的选择(但最难的并且需要更多的工作)将是对这个库进行逆向工程。我将来可能会这样做,但现在我需要简单的解决方案。

我应该怎么做才能让它工作?

4

0 回答 0