Using a different linker in a CMake project

Steve Kargl sgk at troutmask.apl.washington.edu
Thu Sep 26 16:41:25 UTC 2019


On Thu, Sep 26, 2019 at 06:18:17PM +0200, Willem Jan Withagen wrote:
> 
> 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"
> 
> So I'm trying to pass that also in the ports Makefile as a CMAKE_ARGS.
> But nothing thusfar I've tried does actually work. and gets the option
> on the commandline.
> 
> So is there a way to get this to work.
> It is sort of tricky since CMAKE output uses cc of c++ to do linking.
> 
> A brute force hack would be to
> 	rm /usr/bin/ld
> 	ln -s /usr/local/bin/ld /usr/bin/ld
> But I sure that that would not make it in the porst tree.
> 

% cat Makefile
PATH = /usr/bin:/bin
.unexport-env
.export PATH

all:
 @echo ${PATH}
 which ld

% which ld
/usr/local/bin/ld
% make
/usr/bin:/bin
which ld
/usr/bin/ld

HTH

-- 
Steve


More information about the freebsd-ports mailing list