Re: Problems compiling kernel

From: Mark Millard via freebsd-current <freebsd-current_at_freebsd.org>
Date: Thu, 30 Dec 2021 21:27:20 UTC
> Dear all,
> 
> on a system updated yesterday I get
> 
> tuexen_at_head:~/freebsd-src % git branch
> * main
> tuexen_at_head:~/freebsd-src % git pull
> Already up to date.
> tuexen_at_head:~/freebsd-src % uname -a
> FreeBSD head 14.0-CURRENT FreeBSD 14.0-CURRENT #1 main-n252035-63f7f3921bd: Thu Dec 30 11:33:16 CET 2021     root_at_head:/usr/obj/usr/home/tuexen/freebsd-src/amd64.amd64/sys/TCP  amd64
> tuexen_at_head:~/freebsd-src % sudo make -j 4 kernel KERNCONF=TCP
> ld-elf.so.1: Shared object "libc++.so.1" not found, required by "cc"
> make: "/usr/home/tuexen/freebsd-src/share/mk/bsd.compiler.mk" line 201: warning: "cc -v 2>&1 | grep "gcc version"" returned non-zero status
> make: "/usr/home/tuexen/freebsd-src/share/mk/bsd.compiler.mk" line 205: Unable to determine compiler type for CC=cc.  Consider setting COMPILER_TYPE.
> 
> make: stopped in /usr/home/tuexen/freebsd-src
> tuexen_at_head:~/freebsd-src % 
> 
> any idea what I did wrong and how to fix it?

The problem is in FreeeBSD itself from:

git: 6b1c5775d1c2 - main - Move libc++ from /usr/lib to /lib Ed Maste
(2021-Dec-29)

until the revert:

git: b6f7942cbcbd - main - Revert "Move libc++ from /usr/lib to /lib" Ed Maste

or, the fixed commit, if you want /lib/libc++.so.1 :

git: 5e6a2d6eb220 - main - Reapply: move libc++ from /usr/lib to /lib Dimitry Andric
(2021-Dec-30)

6b1c5775d1c2 did not actually cause /lib/libc++.so.1 to be installed
but still put it at /usr/lib/libc++.so.1 . But its delete-old-libs
did remove /usr/lib/libc++.so.1 . (I suffered this too.)

A solution is to find libc++.so.1 in your build tree and to
copy it to one of the two places (old or new). So, for example:

.../amd64.amd64/lib/libc++/libc++.so.1

or, may be:

.../amd64.amd64/tmp/lib/libc++.so.1

Some old trees used for chroot use or the like can also
be a source for doing such a copy. (That is what I did.)

There will likely be another commit making it nicer
for NO_CLEAN style builds. 5e6a2d6eb220 is okay for
META_MODE builds or complete rebuilds.

I also wonder if they will create a:

/usr/lib/libc++.so -> ../../lib/libc++.so.1

or not, analogous to the existing:

/usr/lib/libcxxrt.so -> ../../lib/libcxxrt.so.1



===
Mark Millard
marklmi at yahoo.com