Which dynamic library is being used?
Is there an equivalent to "which" that will tell me, which dynamic/shared library will be loaded by an executable at runtime? For example, "which libwhatever.so" would determine, based on environment variables and system defaults, the locations of the libwhatever.so that will be loaded by an exeuctable at runtime?
|
ldd <executable>
|
I'm aware of ldd. It takes the executable as an argument, not the name of a dynamic library.
How does ldd figure out which dynamic library to use? I'd like to know if there is a tool that does that. |
Quote:
Quote:
Quote:
Code:
$ ldd /bin/bash Which is what you asked for. |
I guess I'm not making myself clear. I'm looking for a tool that takes only the dynamic library name, and not an executable name, as an argument, and figures out which actual library will be loaded by a hypothetical executable at run-time. Don't assume that I have an existing executable that needs that library: but if I did, you're right, ldd would work fine.
I could write a Perl script that searches the LD_LIBRARY_PATH, and it would be fairly trivial. But since ldd (and ld.so) must already do this, I thought that maybe such a tool already existed. Anyway, thanks for your help. |
According to this http://linux.die.net/man/1/ldd you can in fact pass a lib name to ldd as well.
|
A good solution to this was provided in another thread by lutusp, who also responded to this thread: whereis. That locates more than just binary executables, but include files and library files as well.
Thanks for all the help. |
All times are GMT -5. The time now is 04:28 PM. |