DragonFly users List (threaded) for 2008-06
DragonFly BSD
DragonFly users List (threaded) for 2008-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Library path for compiling/linking


From: Vincent <vince.dragonfly@xxxxxxxxxxx>
Date: Mon, 16 Jun 2008 03:25:56 -0500

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.





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