llvm-runtimes/libcxx: pass -DCMAKE_CXX_COMPILER_WORKS=1 with no GCC

Since libc++ package is merged before llvm-runtimes/clang-stdlib-config
during a LLVM version update, clang will attempt to use libstdc++ for
the C++ compiler check, and will fail if it is missing. To mitigate
this, pass -DCMAKE_CXX_COMPILER_WORKS=1 to cmake to skip the check if
GCC is not installed on the system. libc++ still compiles as expected.

[sam: Add -b to has_version.]

Signed-off-by: Violet Purcell <vimproved@inventati.org>
Part-of: https://github.com/gentoo/gentoo/pull/45422
Closes: https://github.com/gentoo/gentoo/pull/45422
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Violet Purcell
2026-01-17 20:10:25 -05:00
committed by Sam James
parent 227d631d98
commit 569deb0cac
2 changed files with 12 additions and 0 deletions

View File

@@ -145,6 +145,12 @@ multilib_src_configure() {
# this is broken with standalone builds, and also meaningless
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
)
if ! has_version -b sys-devel/gcc; then
# Since this package is merged before llvm-runtimes/clang-stdlib-config,
# clang will attempt to use libstdc++ for the C++ compiler check, and will
# fail if it is missing.
mycmakeargs+=( -DCMAKE_CXX_COMPILER_WORKS=1 )
fi
if is_crosspkg; then
# Needed to target built libc headers
local -x CFLAGS="${CFLAGS} -isystem ${ESYSROOT}/usr/${CTARGET}/usr/include"

View File

@@ -144,6 +144,12 @@ multilib_src_configure() {
# this is broken with standalone builds, and also meaningless
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
)
if ! has_version -b sys-devel/gcc; then
# Since this package is merged before llvm-runtimes/clang-stdlib-config,
# clang will attempt to use libstdc++ for the C++ compiler check, and will
# fail if it is missing.
mycmakeargs+=( -DCMAKE_CXX_COMPILER_WORKS=1 )
fi
if is_crosspkg; then
# Needed to target built libc headers
local -x CFLAGS="${CFLAGS} -isystem ${ESYSROOT}/usr/${CTARGET}/usr/include"