Don L. Belcher
2004-Dec-15 23:13 UTC
[Fwd: Cannot find libraries in /usr/local/lib even though they are in hints files]
FreeBSD satellite.siad.net 4.10-STABLE FreeBSD 4.10-STABLE #0: Mon Jul 19 00:39:31 PDT 2004 Cannot find libraries in /usr/local/lib even thought they are in the hints file. Is there something else I need to do? satellite% ld -o hello -lmpeg hello.o /usr/libexec/elf/ld: cannot find -lmpeg satellite% ldconfig -r | grep mpeg 464:-lmpeg.1 => /usr/local/lib/libmpeg.so.1 satellite% ldconfig -r | more /var/run/ld-elf.so.hints: search directories: /usr/lib:/usr/lib/compat:/usr/X11R6/lib:/usr/local/lib:/usr/local/lib/compat:/usr/local/lib/mysql:/usr/local/lib/ compat/pkg:/usr/local/lib/pth:/usr/local/lib/wine:/usr/local/lib/kde3 satellite% ll /usr/local/lib/libmpeg.a -r--r--r-- 1 root wheel 132902 Apr 11 2001 /usr/local/lib/libmpeg.a Using a library in /usr/lib works: satellite% ld -o hello -lpam hello.o /usr/libexec/elf/ld: warning: cannot find entry symbol _start; defaulting to 080481c0 hello.o: In function `main': hello.o(.text+0x25): undefined reference to `puts' It also works if I manually add the library path satellite% ld -o hello -lmpeg -L/usr/local/lib hello.o /usr/libexec/elf/ld: warning: cannot find entry symbol _start; defaulting to 080481c8 hello.o: In function `main':
Edwin Groothuis
2004-Dec-15 23:17 UTC
[Fwd: Cannot find libraries in /usr/local/lib even though they are in hints files]
On Thu, Dec 16, 2004 at 02:13:18AM -0500, Don L. Belcher wrote:> Cannot find libraries in /usr/local/lib even thought they are in the > hints file. Is there something else I need to do?Use the -L option for gcc (and other utilities) to specify the location to search for libraries to be linked. ldconfig is for run-time linking, not for compile-time linking. -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/