HardenedBSD 14.2S build failure with libc++

3 views
Skip to first unread message

Dewayne Geraghty

unread,
Feb 24, 2025, 1:12:48 AMFeb 24
to us...@hardenedbsd.org
During a make buildworld of 14.2S on platform:
# uname -vKU; clang -v
FreeBSD 13.2-STABLE-HBSD myworkingbranch-n192055-d8d941603dd
HARDENEDBSD-13-STABLE 1302509 1302509
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git
llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd13.2

Failure message:

error: invalid value 'c++23' in '-std=c++23'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and
GNU extensions' standard
...
note: use 'c++20' for 'ISO C++ 2020 DIS' standard
note: use 'gnu++20' for 'ISO C++ 2020 DIS with GNU extensions' standard
note: use 'c++2b' for 'Working draft for ISO C++ 2023 DIS' standard
note: use 'gnu++2b' for 'Working draft for ISO C++ 2023 DIS with GNU
extensions' standard
*** [algorithm.o] Error code 1

make[4]: stopped in /big/hardenedbsd-14-stable/lib/libc++
1 error

# find /usr/src/ -type f | xargs grep 'c++23'
/usr/src/lib/libc++/Makefile:CXXSTD?= c++23

Check reference:
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD/-/blob/hardened/current/master/lib/libc++/Makefile?ref_type=heads

So a temporary workaround is to replace c++23 with c++20 in
lib/libc++/Makefile

.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 130000
# NOTE: gcc 12 cannot correctly compile all libc++'s C++23 code. To
temporarily
# support gcc 12, compile libc++ in C++20 mode, but this will leave out any
# C++23 features.
CXXSTD?= c++20
.else
# 202502 DPG kludge because of clang 16.0.6 on HBSD13.2S failure with
# CXXSTD?= c++23
CXXSTD?= c++20
.endif

Hope that this is helpful.

Dewayne Geraghty

unread,
Feb 27, 2025, 2:45:49 AMFeb 27
to us...@hardenedbsd.org
Update. After installing 14.2 and reverting my change in
/usr/src/lib/libc++/Makefile from
CXXSTD?= c++20, back to
CXXSTD?= c++23
the buildworld was successful. I note that FreeBSD had made this change
between 14.1R and 14.2R, I should've checked their git first as this was
the source of the issue.

In short: clang 16.0.6 doesn't support c++23.
Cheers.

PS I do not have WITHOUT_CLANG_BOOTSTRAP= in /etc/src.conf and expected
the world to use the later clang (?)
Reference: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285063
Reply all
Reply to author
Forward
0 new messages