commit: 569deb0cacaf243d6f56e8c0eb5c2fb1fa1317b0 Author: Violet Purcell <vimproved <AT> inventati <DOT> org> AuthorDate: Sun Jan 18 01:10:25 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Jan 18 01:21:32 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=569deb0c
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 <AT> 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 <AT> gentoo.org> llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild | 6 ++++++ llvm-runtimes/libcxx/libcxx-22.1.0_rc1.ebuild | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild b/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild index e0e4478f8d0d..40f9d3912768 100644 --- a/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild +++ b/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild @@ -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" diff --git a/llvm-runtimes/libcxx/libcxx-22.1.0_rc1.ebuild b/llvm-runtimes/libcxx/libcxx-22.1.0_rc1.ebuild index 7d224001ae1b..670bccda0c24 100644 --- a/llvm-runtimes/libcxx/libcxx-22.1.0_rc1.ebuild +++ b/llvm-runtimes/libcxx/libcxx-22.1.0_rc1.ebuild @@ -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"
