誰かが理由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
。 AFAIKrpm -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