누군가 이유 ldd
와 rpm -q --requires
출력이 서로 다른 이유를 설명할 수 있습니까?
알아보고 있습니다curl
[root@localhost ~]# rpm -qa curl
curl-7.29.0-59.el7_9.1.x86_64
[root@localhost ~]# ldd /usr/bin/curl
linux-vdso.so.1 => (0x00007ffe07f09000)
libcurl.so.4 => /lib64/libcurl.so.4 (0x00007fa3d7e2e000)
libssl3.so => /lib64/libssl3.so (0x00007fa3d7bd1000)
libsmime3.so => /lib64/libsmime3.so (0x00007fa3d79a9000)
libnss3.so => /lib64/libnss3.so (0x00007fa3d7675000)
libnssutil3.so => /lib64/libnssutil3.so (0x00007fa3d7445000)
libplds4.so => /lib64/libplds4.so (0x00007fa3d7241000)
libplc4.so => /lib64/libplc4.so (0x00007fa3d703c000)
libnspr4.so => /lib64/libnspr4.so (0x00007fa3d6dfe000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa3d6be2000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa3d69de000)
libz.so.1 => /lib64/libz.so.1 (0x00007fa3d67c8000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa3d63fa000)
libidn.so.11 => /lib64/libidn.so.11 (0x00007fa3d61c7000)
libssh2.so.1 => /lib64/libssh2.so.1 (0x00007fa3d5f9a000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fa3d5d4d000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fa3d5a64000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fa3d5831000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fa3d562d000)
liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007fa3d541e000)
libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00007fa3d51c9000)
librt.so.1 => /lib64/librt.so.1 (0x00007fa3d4fc1000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa3d8098000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007fa3d4d4f000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fa3d48ec000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fa3d46dc000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fa3d44d8000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fa3d42be000)
libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fa3d40a1000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fa3d3e7a000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fa3d3c43000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa3d39e1000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fa3d37de000)
그러나 런타임에는 반환된 rpm -q --requires curl-7.29.0-59.el7_9.1.x86_64
것과 같은 일부 공유 라이브러리를 얻지 못합니다 /lib64/libk5crypto.so.3
. AFAIK rpm -q --requires
실행에 필요한 모든 기능을 반환해야 합니다 .curl-7.29.0-59.el7_9.1.x86_64
[root@localhost ~]# rpm -q --requires curl-7.29.0-59.el7_9.1.x86_64
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.17)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libcurl = 7.29.0-59.el7_9.1
libcurl.so.4()(64bit)
libdl.so.2()(64bit)
libnspr4.so()(64bit)
libnss3.so()(64bit)
libnssutil3.so()(64bit)
libplc4.so()(64bit)
libplds4.so()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libsmime3.so()(64bit)
libssl3.so()(64bit)
libz.so.1()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1
그러나 strace
컬을 실행하면 언급된 공유 라이브러리가 "호출"되는 것을 볼 수 있습니다.
[root@localhost ~]# strace curl 2>&1 | grep open
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libcurl.so.4", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libssl3.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libsmime3.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnss3.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnssutil3.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libplds4.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libplc4.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnspr4.so", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libidn.so.11", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libssh2.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libgssapi_krb5.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libkrb5.so.3", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libk5crypto.so.3", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libcom_err.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/liblber-2.4.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libldap-2.4.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libssl.so.10", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libcrypto.so.10", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libkrb5support.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libkeyutils.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libsasl2.so.3", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libfreebl3.so", O_RDONLY|O_CLOEXEC) = 3
open("/etc/pki/tls/legacy-settings", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
open("/root/.curlrc", O_RDONLY) = -1 ENOENT (No such file or directory)
내가 무엇을 놓치고 있나요?
답변1
ldd
목록모두합격에 필요한 라이브러리를 포함한 필수 라이브러리입니다. RPM 메타데이터는 직접적인 종속성만 나열합니다.
$ readelf -d /usr/bin/curl | grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libcurl.so.4]
0x0000000000000001 (NEEDED) Shared library: [libssl3.so]
0x0000000000000001 (NEEDED) Shared library: [libsmime3.so]
0x0000000000000001 (NEEDED) Shared library: [libnss3.so]
0x0000000000000001 (NEEDED) Shared library: [libnssutil3.so]
0x0000000000000001 (NEEDED) Shared library: [libplds4.so]
0x0000000000000001 (NEEDED) Shared library: [libplc4.so]
0x0000000000000001 (NEEDED) Shared library: [libnspr4.so]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libz.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
위 명령은 바이너리 자체가 종속성으로 선언하는 라이브러리를 나열합니다. 이는 종속성 목록과 일치합니다(버전 기호와 함께 참고자료 참조 readelf -V
). 표시된 다른 모든 라이브러리는 ldd
전이적 종속성입니다.
전이적 라이브러리 종속성은 전이적 RPM 종속성에 반영됩니다. 예를 들어 Kerberos 라이브러리가 가져와서 메타데이터 libcurl.so.4
에 나타납니다 .libcurl