autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linker default library search path


From: Bob Proulx
Subject: Re: linker default library search path
Date: Thu, 1 Jun 2006 00:34:17 -0600
User-agent: Mutt/1.5.9i

Guillaume Rousse wrote:
> I recently get surprised by different behaviour of AC_CHECK_LIB on
> x86_64 and i586 mandriva machines. It seems than on the first one,
> /usr/local/lib is also part of the default search path. I read ld
> documentation, but I couldn't find any way to explicitely check my
> assumption. So, is there any way to display linker default library
> search path ?

Usually the compiled in default path is /lib and /usr/lib.  The man
page for ld.so should document this.

  man ld.so

I would peek in the binary and check that those paths are also in the
binary too.  (/lib/ld-linux.so.2 on i686 systems.)

  strings /lib/ld-linux-x86-64.so.2 | grep /lib/
  /lib/
  /usr/lib/

Additionally /etc/ld.so.conf instructs ldconfig what paths to put in
/etc/ld.so.cache which is used by the ld.so.

  man ldconfig

In summary it is /lib:/usr/lib plus the contents of /etc/ld.so.conf
plus the setting of LD_LIBRARY_PATH.

I am not sure where this is documented but the LD_DEBUG variable may
be set to trace interesting information about the actions of the
dynamic loader.

  LD_DEBUG=help /lib/ld-linux-x86-64.so.2
  ...
  libs        display library search paths
  ...

Which means you can display the search path for your program by
setting that variable for the command run and tracing the output.

  LD_DEBUG=libs cat /dev/null

Hope that helps,
Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]