commit: d2da31f41428439e273db7f1a8c8c3ff883641ed Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Jul 12 12:19:36 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Mon Jul 17 09:44:19 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2da31f4
distutils-r1.eclass: Disable LTO when using cargo.eclass Strip LTO flags when cargo.eclass is inherited. This means that Rust extensions are being built, and linking them with C/C++ style LTO results in broken shared libraries. Closes: https://bugs.gentoo.org/910220 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> eclass/distutils-r1.eclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 924e83b54ad8..e4f0589e191b 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -191,6 +191,7 @@ esac if [[ -z ${_DISTUTILS_R1_ECLASS} ]]; then _DISTUTILS_R1_ECLASS=1 +inherit flag-o-matic inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then @@ -1836,6 +1837,12 @@ distutils-r1_run_phase() { local -x CYTHON_FORCE_REGEN=1 fi + # Rust extensions are incompatible with C/C++ LTO compiler + # see e.g. https://bugs.gentoo.org/910220 + if has cargo ${INHERITED}; then + filter-lto + fi + # How to build Python modules in different worlds... local ldopts case "${CHOST}" in