正如问题所述,我需要查看我的程序如何查找共享库。我有一个自定义libc,它不在/lib中,我希望我的程序使用这个版本。首先,我使用LD_LIBRARY_PATH
指向我的自定义库目录,除了libsystemd所需的libc之外,所有其他依赖项都成功找到了。正如错误消息所述,尽管设置了LD_LIBRARY_PATH
,它仍在/lib中查找libc:
./test: /lib/libc.so.6: version `GLIBC_2.30' not found (required by /mnt/SDCARD/lib/custom/libsystemd.so.0)
我甚至试着在libsystemd中添加一个新的RUNPATH
,它以前没有设置过,但没有起作用:
Dynamic section at offset 0x7a000 contains 37 entries:
Tag Type Name/Value
0x0000001d (RUNPATH) Library runpath: [/mnt/SDCARD/lib/custom/]
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [liblzma.so.5]
0x00000001 (NEEDED) Shared library: [libzstd.so.1]
0x00000001 (NEEDED) Shared library: [liblz4.so.1]
0x00000001 (NEEDED) Shared library: [libgcrypt.so.20]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x00000001 (NEEDED) Shared library: [ld-linux-armhf.so.3]
0x0000000e (SONAME) Library soname: [libsystemd.so.0]
libsystemd忽略硬编码的RUNPATH
和LD_LIBRARY_PATH
。有没有办法查看我的程序是如何搜索共享库的?是什么导致了这个问题?
1条答案
按热度按时间qco9c6ql1#
LD_DEBUG env变量允许查看搜索共享库的位置