Operating System - HP-UX
1753317 Members
5284 Online
108792 Solutions
New Discussion юеВ

Re: ldd reports absolute path dependencies

 
SOLVED
Go to solution
Roberto Martinez_6
Frequent Advisor

ldd reports absolute path dependencies

Hi,
after compiling a program which uses ORACLE shared libraries, executing "ldd " returns all the dependencies as absolute paths, e.g.,

/usr/lib/libc.2 => /usr/lib/libc.2

instead of

libc.2 => /usr/lib/libc.2

. For /usr/lib libraries this is ok, but with oracle libraries, they reside on a directory which is different from target host, so I get a

/usr/lib/dld.sl: Can't open shared library: /lib/libclntsh.sl.8.0

, instead of searching the library among LD_LIBRARY_PATH or SHLIB_PATH directories.

How can I tell the linker to insert non-absolute references to external libraries?
I've tried the +s option, without success.

Thanks in advance.
It wasn't me
5 REPLIES 5
harry d brown jr
Honored Contributor

Re: ldd reports absolute path dependencies

from "man ld"

+cdp oldpath:newpath
Replace the recorded path for a shared library in the a.out. In 32-bit mode, ld records the absolute path names of any shared libraries searched at link time in the a.out file. When the program begins execution, the dynamic loader attaches any shared libraries that were searched at link time. Although you can use the +b and/or +s linker options to direct the dynamic loader to directories to search for the shared libraries, the dynamic loader, as a last resort, searches for the shared libraries in its absolute, recorded path in the a.out. You can specify more than one shared library oldpath:newpath, but each must be preceded by the +cdp option.

Are you running 32bit or 64bit?

live free or die
harry d brown jr
Live Free or Die
Roberto Martinez_6
Frequent Advisor

Re: ldd reports absolute path dependencies

compiling in 32 bits, OE in 64 bit. I'll check and answer.
It wasn't me
Stephen Keane
Honored Contributor
Solution

Re: ldd reports absolute path dependencies

chatr +s enable exe_name

Will tell the dld to use SHLIB_PATH if it can't find the libraries at the absolute addresses quoted by ldd.
ranganath ramachandra
Esteemed Contributor

Re: ldd reports absolute path dependencies

you can use the (new! for pa32) linker option "+nodefaultrpath". this will make the linker record only the basenames of libraries specified with -l on the link line. note that
- you have to make sure that either embedded path or SHLIB_PATH will be able to find these libararies at run-time
- if you specify full library paths in the link line, they will still be recorded completely.
 
--
ranga
[i work for hpe]

Accept or Kudo

Roberto Martinez_6
Frequent Advisor

Re: ldd reports absolute path dependencies

Thank you all, it worked.
It wasn't me