Dan
Dan

Reputation: 1

ldd command searching libs at some arbitrary location

I ran truss command on executable and get the below output:

stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/rw7/librt.so.1", 0x080474A0) (sleeping...) stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/rw7/librt.so.1", 0x080474A0) Err#2 ENOENT stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/librt.so.1", 0x080474A0) (sleeping...)

I went through the build logs and Envs of buildhost but the LD_LIB_PATH, LIBPATH, LD_RUN_PATH value is not pointing to this location. I am not able to get that from where this value came?

Can any one help me in understanding this? how the lib search path decided? How to troubleshoot the same?

Upvotes: 0

Views: 1160

Answers (4)

Dan
Dan

Reputation: 1

Thank you guys for your help. I found the issue. some one has removed /opt/studio11 directory and make a link to /net/xyzmachine/vol/tools/solx64/studio11. so during compilation it is showing me as /opt/studio11/.... but in map file it is keeping "net/xyzmachine/vol/tools/solx64/studio11" value.

Thanks once again for your help.

Upvotes: 0

Burton Samograd
Burton Samograd

Reputation: 3638

Looks like you might have your rpath set in the executable. Try:

chrpath /path/to/binary

And see if that prints anything like the paths you're getting from ldd. To remove your rpath and use standard system libraries use:

chrpath -d /path/to/executable

Upvotes: 0

Dmitry Yudakov
Dmitry Yudakov

Reputation: 15734

Perhaps this library is dependency of some of your application's dependencies. ldd prints recursively all shared libraries, that your application or its dependency depend on.

It searches the libraries in paths described in /etc/ld.so.conf (/etc/ld.so.conf.d/) or LD_LIBRARY_PATH.

Note that also rpath could be set in the shared library itself.

More info here: Program-Library-HOWTO

Upvotes: 1

Benoit Thiery
Benoit Thiery

Reputation: 6387

The linker used to create the executable has probably hardcoded some path directly in the executable. Most linkers do that by default and allow to specify options on the command line to add specific additional paths to look at for .so libraries.

Upvotes: 0

Related Questions