Linking ports with LLD: no default library search paths
emaste at freebsd.org
Fri Sep 1 14:57:08 UTC 2017
As mentioned recently on this list I've been investigating building
the ports tree with LLVM's lld installed as /usr/bin/ld (via the
exp-run in PR 214864).
One of the common failure causes is that LLD does not include default
library search paths (e.g., /usr/lib). Paths must be explicitly
specified via -L on the command line. The vast majority of software
uses the compiler driver (cc) for linking which passes the correct
paths to the linker, but a small number of ports invoke the linker
directly and need some change to work with LLD.
This issue affects (at least) these 18 FreeBSD ports:
The best fix for each of these is probably to have a change upstream
to use the compiler driver for linking instead of a direct ld
invocation. Otherwise, we can just add -L/usr/lib to the linker flags,
or add LLD_UNSAFE=yes to the port Makefile to forbid the port from
using lld. Note that -L/usr/lib can in general be added
unconditionally; it causes no harm to pass it to GNU BFD ld.
print/gl2ps was already changed this way (PR218399, r448652).
I'm working through the list of ports that fail to link with LLD,
starting with those responsible for the largest number of dependent
skipped ports. If maintainers of these ports are interested I'm happy
to help look at changes for any of these ports or help with testing
More information about the freebsd-ports