Using a different linker in a CMake project
Jan Beich
jbeich at FreeBSD.org
Thu Sep 26 17:48:49 UTC 2019
Willem Jan Withagen <wjw at digiware.nl> writes:
> Hi,
>
> For building ceph14 in I need to use ld from the ports binutils.
> Mainly because of versioning that I can not get to work with the llvm
> linker, and is a know difference between GNU ld en LLVM ld.
>
> Just building in the project I was able to do that with:
> -D CMAKE_CXX_FLAGS_DEBUG=" -fuse-ld=/usr/local/bin/ld
> -Wno-unused-command-line-argument"
Try defining LLD_UNSAFE=yes in port's Makefile. It'd be translated to
LDFLAGS+=-fuse-ld=bfd and then by USES=cmake into
-DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \
$ make -V CMAKE_ARGS:M\*bfd\* LLD_UNSAFE=
-DCMAKE_EXE_LINKER_FLAGS:STRING=" -fstack-protector-strong -fuse-ld=bfd " -DCMAKE_MODULE_LINKER_FLAGS:STRING=" -fstack-protector-strong -fuse-ld=bfd " -DCMAKE_SHARED_LINKER_FLAGS:STRING=" -fstack-protector-strong -fuse-ld=bfd "
However, if you need /usr/local/bin/ld.bfd rather than /usr/bin/ld.bfd
on FreeBSD 11.* define USE_BINUTILS and pass LDFLAGS+=-B${LOCALBASE}/bin .
More information about the freebsd-ports
mailing list