all_subdir_lib/libclang_rt build failure (libc++ ld error)

From: Alain Zscheile <zseri.devel+fbsd_at_ytrizja.de>
Date: Tue, 20 Dec 2022 23:12:40 UTC
Hello,

I encountered a build failure while trying to build fbsd'
src.git commit ae521fda895ff0b5076904f08ec92e3c60d53701
with `make -j4 buildworld` on an FreeBSD 13.1 system.

<snip>
--- all_subdir_lib/libclang_rt ---
ld: error: /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/libc++.so:2:
   cannot find /usr/lib/libc++.so.1 inside
   /usr/obj/usr/src/amd64.amd64/tmp
>>> GROUP ( /usr/lib/libc++.so.1 /usr/lib/libcxxrt.so )
>>>         ^
c++: error: linker command failed with exit code 1
   (use -v to see invocation)

make[2]: stopped in /usr/src
</snip>

The stated file is indeed not present, and resides in .../tmp/lib
instead of .../tmp/usr/lib. It appears that the .so linker script
should either be patched (to point to /lib instead of /usr/lib) or
a symlink for the .so.1 file should be created.
(at least the corresponding c++ command line doesn't indicate
  anything to the contrary of that afaik)

I don't know when this problem was introduced and it might be the
case that this bootstrapping problem only occurs when the "outside
system" (in this case FreeBSD 13.1) has an older version of clang.
(as I'm not really sure when the bootstrapping process actually
  kicks in, as it appears to have omitted building a linker when it
  detected that the current one is recent enough/matches)
It might also be that case that this is just the result of a
missing dependency, which messes with parallel building, idk...

Regards,
Alain Zscheile