Re: Why is main's system clang (12.0.1-rc2) using /usr/local/bin/aarch64-unknown-freebsd14.0-ld ? (such breaks things)

From: Mark Millard via toolchain <toolchain_at_freebsd.org>
Date: Fri, 16 Jul 2021 10:38:00 UTC

On 2021-Jul-16, at 02:55, J P <webplication@gmail.com> wrote:

> El 2021-07-16 09:53, Mark Millard via toolchain escribió:
> [...]
>> # find / -name aarch64-unknown-freebsd14.0-ld -print | more
>> /usr/local/bin/aarch64-unknown-freebsd14.0-ld
> 
> First unusual thing is the file name, in particular the
> -unknown- part. If it were built by the ports it should be
> -portbld- instead, so it seem this was built from /usr/src
> but in this case it should not be in /usr/local.
> 
> Can you
> pkg which /usr/local/bin/aarch64-unknown-freebsd14.0-ld
> ?

# pkg which /usr/local/bin/aarch64-unknown-freebsd14.0-ld
/usr/local/bin/aarch64-unknown-freebsd14.0-ld was installed by package aarch64-binutils-2.33.1_4,1

# pkg delete aarch64-binutils
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 3 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        aarch64-binutils: 2.33.1_4,1
        aarch64-gcc6: 6.5.0_3
        aarch64-gcc9: 9.3.0_1

Number of packages to be removed: 3

The operation will free 278 MiB.

Proceed with deinstalling packages? [y/N]: N

So it exists because I built and installed:

devel/freebsd-gcc6@aarch64
devel/freebsd-gcc9@aarch64
devel/binutils@aarch64

> Or some other how know where you get that linker from?
> 
> 
> The second unusual thing is that system cc gives precedence
> to /usr/local/bin stuff.
> 
> I do not have /usr/local/bin/aarch64-unknown-freebsd14.0-ld
> and when I compile your trivial.cpp example I get:
> [...]
> End of search list.
> "/usr/bin/ld" --eh-frame-hdr
> [...]
> 
> If I add that file, I get instead your reported behavior:
> cp /usr/bin/ld /usr/local/bin/aarch64-unknown-freebsd14.0-ld
> cc -v -o trivial trivial.cpp
> [...]
> End of search list.
> "/usr/local/bin/aarch64-unknown-freebsd14.0-ld" --eh-frame-hdr
> [...]
> 
> I suspect this is intentional as it allows to build
> stuff from /usr/src with toolchains from the ports, but
> I am not sure, in fact when I
> /usr/local/bin # mv aarch64-unknown-freebsd14.0-ld
> aarch64-portbld-freebsd14.0-ld
> 
> the linker is /usr/bin/ld, not
> /usr/local/bin/aarch64-portbld-freebsd14.0-ld
> 

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)