How can I see where libraries are being loaded from on Linux?
To figure out where libraries are being loaded from, if you have your environment already setup in the same way for which you want to test, then you can run:
/sbin/ldconfig -N -v
However, this will not search LD_LIBRARY_PATH so you must also include that manually:
/sbin/ldconfig -N -v $(sed ‘s/:/ /g’ <<< $LD_LIBRARY_PATH)
If you would like to see which libraries are actually being loaded when running an executable, then use:
This will show you a lot more than you care to see (all system calls), but if you grep the results for “^open.*\.so”, then you will see all of the *.so files which are being opened from that process.
I also see several processes which fork child processes and strace will not report system calls for these by default. However, you can add the ‘-f’ switch to strace and then all child processes will be reported:
strace -f myprog
This will produce a fair amount of noise, but you can filter that with:
strace -e trace=open -f myprog
TheSoftwareProgrammer View All
I like science and writing software.
Leave a Reply