ld can't find libraries
edwin at mavetju.org
Wed Mar 31 21:34:06 PST 2004
On Wed, Mar 31, 2004 at 10:12:23PM +0000, Richard Bradley wrote:
> I can't get ld to recognise some "so" libraries without using the -L option:
Ldconfig is used for run-time loading of shared libraries.
What you are doing here is the compilation (linking...) of the
source to a executable.
gcc (ld...) searches by default only for a couple of standard system
directories (/usr/lib for example) and that's all.
If it would search through other directories by default (for example
/usr/local/lib), and your program was trying to link to a newer
version of a library which is in a non-standard directory with an
old one which was in /usr/local/lib, the program would never be
able to get linked to the right one.
Therefor, at compile (link...) time you have to specify explicitely
in which order to search through which directories.
For run-time loading you can use ldconfig or LD_LIBRARY_PATH to
specify where your libraries are.
Edwin Groothuis | Personal website: http://www.mavetju.org
edwin at mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/
More information about the freebsd-hackers