r/linuxmint • u/lateralspin LMDE 7 Gigi | • 2h ago
SOLVED Build script fails due to C++20 <format> (GCC lacks the vector builtins)
I ran into the following issue with Debian where its clang-20 package installs versioned binaries (/usr/bin/clang-20 and /usr/bin/clang++-20) without creating unversioned clang or clang++ commands; and a build complains of Clang lacking a C++ standard library with C++20 <format> support (GCC lacks the vector builtins).
The solution the web has given is to point clang to clang++-20 globally:
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100 \ --slave /usr/bin/clang++ clang++ /usr/bin/clang++-20
As well as the following suggestion of passing env variables in-line, as in:
CC=clang-20 CXX=clang++-20 CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++ -lc++abi"
However, the build still fails with the C++20 <format> complaint.
---
Okay, I fixed the issue. The script kept failing with a particular line of code:
if ! (cd "$upstream" && ROOT="$upstream" cxx_tools=1 bash -c '. scripts/cxx.sh' > /dev/null); then
if command -v dnf > /dev/null; then
echo 'Fedora: install clang and a C++20 standard library with <format>, then retry.' >&2
fi
exit 1
fiI deleted the offending code block, and it fixed the problem, so it was a coding mistake.
Moral of the story is always read the code to troubleshoot a bug that someone created.
---
Files are missing in the project source, so I think that it is a problem with source code.
•
u/AutoModerator 50m ago
Please Re-Flair your post if a solution is found. How to Flair a post? This allows other users to search for common issues with the SOLVED flair as a filter, leading to those issues being resolved very fast.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.