简体   繁体   中英

How to find out where a program is looking for libraries

The other day I came across a linux command that let me see where a program is expecting to find its libraries. It is very useful to solve library dependency problems for not so popular or proprietary software. I used ldd , it was very informative, but missed one crucial piece of information for me:

ldd -v ./my_executable gave good information for libraries that my_executable can link to. But for those it can not link/find, ldd only gave information like:

<a_library_name.so.version> => not found

What I want is, instead of "not found", I want to see

not found at /path/to/<a_library_name.so.version> .

on linux you can use the LD_DEBUG. This link is helpful.

The information about library paths is stored in /etc/ld.so.conf :

/usr/local/lib64
/usr/local/lib
include /etc/ld.so.conf.d/*.conf
# /lib64, /lib, /usr/lib64 and /usr/lib gets added
# automatically by ldconfig after parsing this file.
# So, they do not need to be listed.

See man ldconfig for more information.

可能您需要strace命令在这里看看http://www.thegeekstuff.com/2011/11/strace-examples/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM