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

From: J P <webplication_at_gmail.com>
Date: Fri, 16 Jul 2021 09:55:32 UTC
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
?

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

BR,