Re: Source upgrade to stable/11 amd64 broken

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 11 Aug 2021 17:44:07 UTC
On 11 Aug 2021, at 05:13, Eugene Grosbein <eugen@grosbein.net> wrote:
> 
> I'm in process of upgrading very old remote FreeBSD server running 9.3-STABLE/amd64.
> First, I used svn to fetch stable/10 sources and performed source upgrade to 10.4-STABLE r369650
> and it went just fine.
> 
> Now it has stock "FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512".
> I did checkout for stable/11 sources via svn but this time buildworld fails early:
> 
> --------------------------------------------------------------
>>>> stage 1.2: bootstrap tools
> --------------------------------------------------------------
> cd /usr/local/src; MAKEOBJDIRPREFIX=/usr/obj/usr/local/src/tmp  INSTALL="sh /usr/local/src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/local/src/tmp  PATH=/usr/obj/usr/local/src/tmp/legacy/usr/sbin:/usr/obj/usr/local/src/tmp/legacy/usr/bin:/usr/obj/usr/local/src/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/local/src/tmp  MAKEFLAGS="-m /usr/local/src/tools/build/mk  -m /usr/local/src/share/mk" make  -f Makefile.inc1  DESTDIR=  BOOTSTRAPPING=1004503  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no  -DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no  MK_LLDB=no MK_TESTS=no  MK_INCLUDES=yes bootstrap-tools
> ===> lib/clang/libllvmminimal (obj,all,install)
> /usr/obj/usr/local/src/tmp/usr/local/src/lib/clang/libllvmminimal created for /usr/local/src/lib/clang/libllvmminimal
> /usr/obj/usr/local/src/tmp/usr/local/src/lib/clang/libllvmminimal/Demangle created for /usr/local/src/lib/clang/libllvmminimal
> /usr/obj/usr/local/src/tmp/usr/local/src/lib/clang/libllvmminimal/Support created for /usr/local/src/lib/clang/libllvmminimal
> /usr/obj/usr/local/src/tmp/usr/local/src/lib/clang/libllvmminimal/TableGen created for /usr/local/src/lib/clang/libllvmminimal
> c++  -O2 -pipe -I/usr/local/src/lib/clang/include -I/usr/local/src/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd11.4\" -DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd11.4\" -DDEFAULT_SYSROOT=\"/usr/obj/usr/local/src/tmp\" -DLLVM_TARGET_ENABLE_AARCH64 -DLLVM_TARGET_ENABLE_ARM -DLLVM_TARGET_ENABLE_MIPS -DLLVM_TARGET_ENABLE_POWERPC -DLLVM_TARGET_ENABLE_SPARC -DLLVM_TARGET_ENABLE_X86 -DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser -DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter -DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler -DLLVM_NATIVE_TARGET=LLVMInitializeX86Target -DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo -DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC -ffunction-sections -fdata-sections -MD -MF.depend.Demangle_ItaniumDemangle.o -MTDemangle/ItaniumDemangle.o -Qunused-arguments -I/usr/obj/usr/local/src/tmp/legacy/usr/include  -std=c++14 -fno-exceptions -fno-rtti -stdlib=libc++ -Wno-c++11-extensions  -c /usr/local/src/contrib/llvm-project/llvm/lib/Demangle/ItaniumDemangle.cpp -o Demangle/ItaniumDemangle.o
> error: invalid value 'c++14' in '-std=c++14'
> *** Error code 1
> 
> Stop.
> make[3]: stopped in /usr/local/src/lib/clang/libllvmminimal
> *** Error code 1
> 
> How do I resolve this?

It's going to be a little tricky, as clang 3.4.1 is too old to support
C++14 properly. I've tried using -std=c++1y since that was the old name
for -std=c++14, but it asserts quite early in the build.

The best way forward is to attempt to buildworld (and buildkernel) with
a clean stable/11 checkout at r360783, which is just before clang 10.0.0
got imported. You will also need to add:

CXXFLAGS.clang=-Wno-out-of-line-declaration

to your src.conf, otherwise it will get an unexpected error during the
build.

After this has completed, install world and kernel and reboot, and then
you should have clang 9.0.0 and the corresponding libc++. This should
allow you to do a regular update to the latest stable/11.

From there you should upgrade to stable/12, as 11 is going EOL in about
a month... :)

-Dimitry