Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2019 19:48:45 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Willem Jan Withagen <wjw@digiware.nl>
Cc:        "ports\@freebsd.org" <ports@freebsd.org>
Subject:   Re: Using a different linker in a CMake project
Message-ID:  <k19v-osn6-wny@FreeBSD.org>
In-Reply-To: <9e4e72ba-f08a-667d-076a-f4d20614b41f@digiware.nl> (Willem Jan Withagen's message of "Thu, 26 Sep 2019 18:18:17 %2B0200")
References:  <9e4e72ba-f08a-667d-076a-f4d20614b41f@digiware.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Willem Jan Withagen <wjw@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 .



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?k19v-osn6-wny>