This repository demonstrates a potential issue when using C++ modules and precompiled headers with LLVM's libc++ standard library implementation.
- Type:
ON
/OFF
- Default:
OFF
- Description: Enables precompiled headers configuration when set to
ON
.
- Type:
ON
/OFF
- Default:
OFF
- Description: Enables string output using
std::format
for library standard testing.
Standard Library Implementation | clang 19.1.7 (Fedora) | clang 21.0.0 (git) |
---|---|---|
libstdc++ 14.2.1 (Fedora) | OK | OK |
libc++ 19.1.7 (Fedora) | Error | Error |
libc++ 21.0.0 (git) | Error | Error |
clang 19.1.7 (Fedora 19.1.7-3.fc41)
COMPILER_CONFIG="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_CLANG_SCAN_DEP=clang-scan-deps"
clang 21.0.0 (git 148111fdcf0e807fe74274b18fcf65c4cff45d63)
COMPILER_CONFIG="-DCMAKE_C_COMPILER=${LLVM_21}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_21}/bin/clang++ -DCMAKE_CXX_COMPILER_CLANG_SCAN_DEP=${LLVM_21}/bin/clang-scan-deps"
libstdc++ 14.2.1 (Fedora 14.2.1-7.fc41)
STDLIB_CONFIG=""
libc++ 19.1.7 (Fedora 19.1.7-1.fc41)
STDLIB_CONFIG="-DCMAKE_EXE_LINKER_FLAGS_INIT='-stdlib=libc++' -DCMAKE_CXX_FLAGS='-stdlib++-isystem/usr/include/c++/v1'"
libc++ 21.0.0 (git 148111fdcf0e807fe74274b18fcf65c4cff45d63)
STDLIB_CONFIG="-DCMAKE_EXE_LINKER_FLAGS_INIT='-stdlib=libc++' \
-DCMAKE_CXX_FLAGS='-stdlib++-isystem${LLVM_21}/include/c++/v1 -isystem${LLVM_21}/include/x86_64-unknown-linux-gnu/c++/v1' \
-DCMAKE_CXX_STANDARD_LIBRARIES='-L${LLVM_21}/lib/x86_64-unknown-linux-gnu -lc++ -lc++abi'"
mkdir build
eval " cmake ${STDLIB_CONFIG} ${COMPILER_CONFIG} -DUSE_PCH=ON -G Ninja -B build"
ninja -C build -v
The build succeeds in all configurations when precompiled headers are disabled (-DUSE_PCH=OFF
).
The corresponding issue is open in the LLVM repository.