how can you tell whether a program is statically linked? And if it is dynamically linked, how do you know what libraries it needs?
The ldd command can answer both questions
shiv@ubuntu:~$ ldd /sbin/ldconfig
not a dynamic executable (ldconfig is not dynmic loadable)
shiv@ubuntu:~$ ldd /bin/ln (ln is dynamic loadable but it needs below listed things to run)
linux-gate.so.1 => (0x00918000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00110000)
/lib/ld-linux.so.2 (0x0033f000)
ldconfig
------------
you use the ldconfig command without parameters to rebuild ld.so.cache
ldconfig -p | less to display ld.so.cache
how does the dynamic loader know where to look for executables?
>>As with many things on Linux, there is a configuration file in /etc.
shiv@ubuntu:~$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
shiv@ubuntu:~$ ls /etc/ld.so.conf.d/*.conf | more
/etc/ld.so.conf.d/GL.conf
/etc/ld.so.conf.d/i486-linux-gnu.conf
/etc/ld.so.conf.d/libasound2.conf
/etc/ld.so.conf.d/libc.conf
/etc/ld.so.conf.d/vmware-tools-libraries.conf
shiv@ubuntu:~$
The ldd command can answer both questions
shiv@ubuntu:~$ ldd /sbin/ldconfig
not a dynamic executable (ldconfig is not dynmic loadable)
shiv@ubuntu:~$ ldd /bin/ln (ln is dynamic loadable but it needs below listed things to run)
linux-gate.so.1 => (0x00918000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00110000)
/lib/ld-linux.so.2 (0x0033f000)
ldconfig
------------
you use the ldconfig command without parameters to rebuild ld.so.cache
ldconfig -p | less to display ld.so.cache
how does the dynamic loader know where to look for executables?
>>As with many things on Linux, there is a configuration file in /etc.
shiv@ubuntu:~$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
shiv@ubuntu:~$ ls /etc/ld.so.conf.d/*.conf | more
/etc/ld.so.conf.d/GL.conf
/etc/ld.so.conf.d/i486-linux-gnu.conf
/etc/ld.so.conf.d/libasound2.conf
/etc/ld.so.conf.d/libc.conf
/etc/ld.so.conf.d/vmware-tools-libraries.conf
shiv@ubuntu:~$
Comments
Post a Comment