commit: e1407e34ad8c8d5d0aee2b750016c3ed95a219a7 Author: Michal Rostecki <vadorovsky <AT> protonmail <DOT> com> AuthorDate: Mon Aug 4 08:05:34 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Tue Sep 2 13:59:05 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1407e34
llvm-runtimes/libcxxabi: Use the partial clang configuration files Initial installation or upgrade of libcxxabi happens before the main slotted clang configuration file is created by llvm-core/clang-runtime. Bulding libcxxabi requires only the linker (`-fuse-ld`) and rtlib (`--rtlib`) configuration to be present. To fix the initial builds, we can use the partial configuration provided by: * llvm-core/clang-linker-config * llvm-runtimes/clang-rtlib-config * llvm-runtimes/clang-unwindlib-config Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com> Closes: https://bugs.gentoo.org/951445 Part-of: https://github.com/gentoo/gentoo/pull/42663 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/42663 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> ....0.0.9999.ebuild => libcxxabi-20.1.8-r1.ebuild} | 33 ++++++++++++++++++---- ....0.0.9999.ebuild => libcxxabi-21.1.0-r1.ebuild} | 30 ++++++++++++++++++-- .../libcxxabi/libcxxabi-22.0.0.9999.ebuild | 28 ++++++++++++++++-- .../libcxxabi/libcxxabi-22.0.0_pre20250831.ebuild | 28 ++++++++++++++++-- 4 files changed, 108 insertions(+), 11 deletions(-) diff --git a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild b/llvm-runtimes/libcxxabi/libcxxabi-20.1.8-r1.ebuild similarity index 73% copy from llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild copy to llvm-runtimes/libcxxabi/libcxxabi-20.1.8-r1.ebuild index d1a2b5b4668a..a06bd9846efb 100644 --- a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild +++ b/llvm-runtimes/libcxxabi/libcxxabi-20.1.8-r1.ebuild @@ -12,6 +12,7 @@ HOMEPAGE="https://libcxxabi.llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86 ~arm64-macos ~x64-macos" IUSE="+clang +static-libs test" REQUIRED_USE="test? ( clang )" RESTRICT="!test? ( test )" @@ -27,6 +28,9 @@ DEPEND=" BDEPEND=" clang? ( llvm-core/clang:${LLVM_MAJOR} + llvm-core/clang-linker-config:${LLVM_MAJOR} + llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR} + llvm-runtimes/clang-unwindlib-config:${LLVM_MAJOR} ) !test? ( ${PYTHON_DEPS} @@ -37,9 +41,7 @@ BDEPEND=" " LLVM_COMPONENTS=( runtimes libcxx{abi,} llvm/cmake cmake ) -LLVM_TEST_COMPONENTS=( - libc llvm/include/llvm/{Demangle,Testing} llvm/utils/llvm-lit -) +LLVM_TEST_COMPONENTS=( libc llvm/utils/llvm-lit ) llvm.org_set_globals python_check_deps() { @@ -47,6 +49,12 @@ python_check_deps() { python_has_version "dev-python/lit[${PYTHON_USEDEP}]" } +test_compiler() { + target_is_not_host && return + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ + <<<'int main() { return 0; }' &>/dev/null +} + multilib_src_configure() { # Workaround for bgo #961153. # TODO: Fix the multilib.eclass, so it sets CTARGET properly. @@ -56,9 +64,24 @@ multilib_src_configure() { if use clang; then llvm_prepend_path -b "${LLVM_MAJOR}" - local -x CC=${CTARGET}-clang - local -x CXX=${CTARGET}-clang++ + local -x CC=${CTARGET}-clang-${LLVM_MAJOR} + local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR} strip-unsupported-flags + + # The full clang configuration might not be ready yet. Use the partial + # configuration of components that libunwind depends on. + local flags=( + --config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,unwindlib,linker}.cfg + ) + local -x CFLAGS="${CFLAGS} ${flags[@]}" + local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}" + local -x LDFLAGS="${LDFLAGS} ${flags[@]}" + fi + + local nostdlib_flags=( -nostdlib++ ) + if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}" + ewarn "${CXX} seems to lack stdlib, trying with ${nostdlib_flags[*]}" fi # link to compiler-rt diff --git a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild b/llvm-runtimes/libcxxabi/libcxxabi-21.1.0-r1.ebuild similarity index 74% copy from llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild copy to llvm-runtimes/libcxxabi/libcxxabi-21.1.0-r1.ebuild index d1a2b5b4668a..32bef1e8a4ab 100644 --- a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild +++ b/llvm-runtimes/libcxxabi/libcxxabi-21.1.0-r1.ebuild @@ -12,6 +12,7 @@ HOMEPAGE="https://libcxxabi.llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86 ~arm64-macos ~x64-macos" IUSE="+clang +static-libs test" REQUIRED_USE="test? ( clang )" RESTRICT="!test? ( test )" @@ -27,6 +28,9 @@ DEPEND=" BDEPEND=" clang? ( llvm-core/clang:${LLVM_MAJOR} + llvm-core/clang-linker-config:${LLVM_MAJOR} + llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR} + llvm-runtimes/clang-unwindlib-config:${LLVM_MAJOR} ) !test? ( ${PYTHON_DEPS} @@ -47,6 +51,12 @@ python_check_deps() { python_has_version "dev-python/lit[${PYTHON_USEDEP}]" } +test_compiler() { + target_is_not_host && return + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ + <<<'int main() { return 0; }' &>/dev/null +} + multilib_src_configure() { # Workaround for bgo #961153. # TODO: Fix the multilib.eclass, so it sets CTARGET properly. @@ -56,9 +66,25 @@ multilib_src_configure() { if use clang; then llvm_prepend_path -b "${LLVM_MAJOR}" - local -x CC=${CTARGET}-clang - local -x CXX=${CTARGET}-clang++ + local -x CC=${CTARGET}-clang-${LLVM_MAJOR} + local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR} strip-unsupported-flags + + # The full clang configuration might not be ready yet. Use the partial + # configuration of components that libunwind depends on. + # + local flags=( + --config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,unwindlib,linker}.cfg + ) + local -x CFLAGS="${CFLAGS} ${flags[@]}" + local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}" + local -x LDFLAGS="${LDFLAGS} ${flags[@]}" + fi + + local nostdlib_flags=( -nostdlib++ ) + if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}" + ewarn "${CXX} seems to lack stdlib, trying with ${nostdlib_flags[*]}" fi # link to compiler-rt diff --git a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild b/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild index d1a2b5b4668a..8fb4c0b593f9 100644 --- a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild +++ b/llvm-runtimes/libcxxabi/libcxxabi-22.0.0.9999.ebuild @@ -27,6 +27,9 @@ DEPEND=" BDEPEND=" clang? ( llvm-core/clang:${LLVM_MAJOR} + llvm-core/clang-linker-config:${LLVM_MAJOR} + llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR} + llvm-runtimes/clang-unwindlib-config:${LLVM_MAJOR} ) !test? ( ${PYTHON_DEPS} @@ -47,6 +50,12 @@ python_check_deps() { python_has_version "dev-python/lit[${PYTHON_USEDEP}]" } +test_compiler() { + target_is_not_host && return + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ + <<<'int main() { return 0; }' &>/dev/null +} + multilib_src_configure() { # Workaround for bgo #961153. # TODO: Fix the multilib.eclass, so it sets CTARGET properly. @@ -56,9 +65,24 @@ multilib_src_configure() { if use clang; then llvm_prepend_path -b "${LLVM_MAJOR}" - local -x CC=${CTARGET}-clang - local -x CXX=${CTARGET}-clang++ + local -x CC=${CTARGET}-clang-${LLVM_MAJOR} + local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR} strip-unsupported-flags + + # The full clang configuration might not be ready yet. Use the partial + # configuration of components that libunwind depends on. + local flags=( + --config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,unwindlib,linker}.cfg + ) + local -x CFLAGS="${CFLAGS} ${flags[@]}" + local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}" + local -x LDFLAGS="${LDFLAGS} ${flags[@]}" + fi + + local nostdlib_flags=( -nostdlib++ ) + if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}" + ewarn "${CXX} seems to lack stdlib, trying with ${nostdlib_flags[*]}" fi # link to compiler-rt diff --git a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0_pre20250831.ebuild b/llvm-runtimes/libcxxabi/libcxxabi-22.0.0_pre20250831.ebuild index d1a2b5b4668a..8fb4c0b593f9 100644 --- a/llvm-runtimes/libcxxabi/libcxxabi-22.0.0_pre20250831.ebuild +++ b/llvm-runtimes/libcxxabi/libcxxabi-22.0.0_pre20250831.ebuild @@ -27,6 +27,9 @@ DEPEND=" BDEPEND=" clang? ( llvm-core/clang:${LLVM_MAJOR} + llvm-core/clang-linker-config:${LLVM_MAJOR} + llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR} + llvm-runtimes/clang-unwindlib-config:${LLVM_MAJOR} ) !test? ( ${PYTHON_DEPS} @@ -47,6 +50,12 @@ python_check_deps() { python_has_version "dev-python/lit[${PYTHON_USEDEP}]" } +test_compiler() { + target_is_not_host && return + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ + <<<'int main() { return 0; }' &>/dev/null +} + multilib_src_configure() { # Workaround for bgo #961153. # TODO: Fix the multilib.eclass, so it sets CTARGET properly. @@ -56,9 +65,24 @@ multilib_src_configure() { if use clang; then llvm_prepend_path -b "${LLVM_MAJOR}" - local -x CC=${CTARGET}-clang - local -x CXX=${CTARGET}-clang++ + local -x CC=${CTARGET}-clang-${LLVM_MAJOR} + local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR} strip-unsupported-flags + + # The full clang configuration might not be ready yet. Use the partial + # configuration of components that libunwind depends on. + local flags=( + --config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,unwindlib,linker}.cfg + ) + local -x CFLAGS="${CFLAGS} ${flags[@]}" + local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}" + local -x LDFLAGS="${LDFLAGS} ${flags[@]}" + fi + + local nostdlib_flags=( -nostdlib++ ) + if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}" + ewarn "${CXX} seems to lack stdlib, trying with ${nostdlib_flags[*]}" fi # link to compiler-rt
