When the base linker is not available, the link needs to be from /usr/bin/ld 
rather than from /usr/local/*/ to /usr/local/bin/ld.lld80 or variant of that. 
Also, programs being compiled do look for /usr/bin/ld or maybe another ld under 
/usr/local/*. There were about two locations that could be used for each 
version of the compiler and its toolchain, one like you described, because 
another also had a soft link.

Mine works, since I have a soft link from /usr/bin/ld to the needed one in 
/usr/local/bin/*

If I remember correctly, installing xtoolchain-llvm didn't do much, except for 
give hints on what to put as XLD. From trial an error, I found that, LD covers 
everything, including what XLD covers, except when XLD is used, it overrides LD 
only for ports. In other words, LD in make.conf covered building the kernel, 
base, and ports. When XLD was set, it overrode LD's settings only for ports. At 
least the X version (XCC, XCXX, compared to CC, CXX) of the other make.conf 
setting.

The point is, I wonder how much confusion is being caused for developers, when 
LD and XLD are not working as they are supposed to. When one gets fixed, but 
ends up with the same problem, because the base linker is used, rather than the 
one make.conf is intended to make work. I wonder if this has to do with why 
some ports require llvm80, and others llvm60, when the assumption is on the 
wrong needed update, when it's not using the linkers from those. I also guess 
that, this is causing difficulties for when trying to make clang's utils work 
for different architectures. A problem like this doesn't help, and it likely 
slows down development, that a new release must be waited for before 
significant improvements can be made. The LD setting in make.conf not working 
properly is a fundamental problem, that can cause other problems, and false 
assumptions.

It's more difficult to see the problem, if the base ld is available.


> Sent: Wednesday, September 04, 2019 at 10:18 AM
> From: <[email protected]>
> Cc: [email protected]
> Subject: Re: linker not using make.conf

> The LD variable only effects the very few cases where the linker is called
> directly.  The linker is almost always run via clang.  If you install the
> xtoolchain-llvm80 port it will install a link from
> /usr/local/llvm80/bin/ld.lld to /usr/local/llvm80/bin/ld which I think will
> be sufficient for your use case.
>
> On Tue, Sep 03, 2019 at 11:04:08PM +0200, Sid wrote:
> > In /etc/make.conf, I have
> >  LD= /usr/local/bin/ld.lld80
> >
> > This is not used for ports. It may be used for building the kernel and 
> > world.
> >
> >  clang-8: error: unable to execute command: Executable "ld" doesn't exist!
> >  clang-8: error: linker command failed with exit code 1 (use -v to see 
> > invocation)
> >  *** Error code 1
> >
> >  XLD= /usr/local/bin/ld.lld80 being set as well also provides the same 
> > error. XD sets it for all, but XLD is only applicable if a different 
> > compiler is used for ports than kernel and the base. When LD is set, XLD 
> > only applies when it is set as well, but this suggests that XLD is not 
> > working correctly either.
> >
> > I have to manually link /usr/bin/ld to /usr/local/bin/ld.lld80 for ports to 
> > build correctly. This is with both make, and with portmaster.
> >
> > I built my computer without ld in the base system, and this has worked 
> > well. make.conf should reference the chosen linker without having to 
> > manually link it. Otherwise, LD in make.conf is not working correctly, and 
> > gives the impression that one linker is used, when it's not. This can cause 
> > faulty conclusions and confusion for developers as well, who think one 
> > linker is set, when it's not.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[email protected]"

Reply via email to