Linux – find shared libraries required by a program
Posted by danielJun 18
List shared or dynamic libraries required by a program
In Linux, the
ldd
is used to find out the shared libraries or dependencies required by a program if it is a dynamic executable. ldd requires the full path to the executable as input.
For instance, the Linux ps
command depends on the following shared or dynamic libraries –
[root@kauai rtc0]# ldd $(which ps) linux-vdso.so.1 => (0x00007ffeb6277000) libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003ef6200000) libproc-3.2.8.so => /lib64/libproc-3.2.8.so (0x0000003ef4e00000) libc.so.6 => /lib64/libc.so.6 (0x0000003ef4a00000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003ef5600000) /lib64/ld-linux-x86-64.so.2 (0x0000003ef4600000)
You can also use the ldd command to find out if an executable has an expected dependencies. In this case, we expect that the htpasswd, login and sshd
commands depend on the crypt library as they prompt a user for a password for authentication purposes –
[root@kauai rtc0]# ldd $(which htpasswd) |grep crypt libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f010c8ab000) [root@kauai rtc0]# ldd $(which login) | grep crypt libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003efd200000) [root@kauai rtc0]# ldd $(which sshd) | grep crypt libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007ffb0b1f2000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007ffb0a988000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007ffb0a015000)
References –
5 comments
You must be logged in to post a comment.