Library path for compiling/linking
Vincent
vince.dragonfly at hightek.org
Mon Jun 16 01:33:37 PDT 2008
Does anybody know how to add library search paths to the environment for
compiling on Dragonfly without having to specify paths with -L on the
command line?
This works fine
$ cc -Wall -g -o testrun -L/usr/pkg/lib -lxslt testrun.c
but without -L it fails
$ cc -Wall -g -o testrun -lxslt testrun.c
/usr/libexec/binutils217/elf/ld: cannot find -lxslt
I have LD_LIBRARY_PATH set.
$ env | grep LD_LIB
LD_LIBRARY_PATH=/usr/local/lib:/usr/pkg/lib
LD_LIBRARY_PATH worked for me before on NetBSD and, if I remember
correctly, Linux and FreeBSD as well. It is still the same variable
that the man page for ld on Dragonfly still says to use.
The man page for ld also says
The linker uses the following search paths to locate required
shared libraries.
8. For a native linker on an ELF system, if the file
/etc/ld.so.conf exists, the list of directories found in that
file.
Which, on Dragonfly, appears to actually be /etc/ld-elf.so.conf. Adding
paths to this file seems to work for runtime linking, but not compile
time.
More information about the Users
mailing list