commit: ce974137d6318c4ebc3321558be253842a72a5e4
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 11 18:21:46 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Oct 11 18:43:44 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce974137
www-client/firefox: fail if LLVM version used by clang and rust does not match
If LLVM version does not match, like seen with rust-1.47.0 which is based on
LLVM 11 but sys-devel/clang in Gentoo is still at version 10 because LLVM 11
is not yet released, linking will fail with errors like
ld.lld: error: Invalid summary version 9. Version should be in the range [1-8]
or
ld.lld: error:
../work/firefox_build/x86_64-unknown-linux-gnu/release/libgkrust.a(gkrust-6d42f0360e1be5e5.gkrust.3v9jvdvg-cgu.0.rcgu.o):
Invalid record
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
www-client/firefox/firefox-78.3.1.ebuild | 19 +++++++++++++++++++
www-client/firefox/firefox-81.0.1-r1.ebuild | 19 +++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/www-client/firefox/firefox-78.3.1.ebuild
b/www-client/firefox/firefox-78.3.1.ebuild
index 99f7f8951b9..37b316bab97 100644
--- a/www-client/firefox/firefox-78.3.1.ebuild
+++ b/www-client/firefox/firefox-78.3.1.ebuild
@@ -393,6 +393,25 @@ pkg_setup() {
llvm_pkg_setup
+ if use clang && use lto ; then
+ local version_lld=$(ld.lld --version 2>/dev/null | awk
'{ print $2 }')
+ [[ -n ${version_lld} ]] && version_lld=$(ver_cut 1
"${version_lld}")
+ [[ -z ${version_lld} ]] && die "Failed to read ld.lld
version!"
+
+ local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep
-F -- 'LLVM version:' | awk '{ print $3 }')
+ [[ -n ${version_llvm_rust} ]] &&
version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
+ [[ -z ${version_llvm_rust} ]] && die "Failed to read
used LLVM version from rustc!"
+
+ if ver_test "${version_lld}" -ne "${version_llvm_rust}"
; then
+ eerror "Rust is using LLVM version
${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}."
+ eerror "You will be unable to link
${CATEGORY}/${PN}. To proceed you have the following options:"
+ eerror " - Manually switch rust version using
'eselect rust' to match used LLVM version"
+ eerror " - Switch to
dev-lang/rust[system-llvm] which will guarantee matching version"
+ eerror " - Build ${CATEGORY}/${PN} without
USE=lto"
+ die "LLVM version used by Rust
(${version_llvm_rust}) does not match with ld.lld version (${version_lld})!"
+ fi
+ fi
+
python-any-r1_pkg_setup
# Avoid PGO profiling problems due to enviroment leakage
diff --git a/www-client/firefox/firefox-81.0.1-r1.ebuild
b/www-client/firefox/firefox-81.0.1-r1.ebuild
index 8ec1f4d60eb..65702e05e32 100644
--- a/www-client/firefox/firefox-81.0.1-r1.ebuild
+++ b/www-client/firefox/firefox-81.0.1-r1.ebuild
@@ -393,6 +393,25 @@ pkg_setup() {
llvm_pkg_setup
+ if use clang && use lto ; then
+ local version_lld=$(ld.lld --version 2>/dev/null | awk
'{ print $2 }')
+ [[ -n ${version_lld} ]] && version_lld=$(ver_cut 1
"${version_lld}")
+ [[ -z ${version_lld} ]] && die "Failed to read ld.lld
version!"
+
+ local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep
-F -- 'LLVM version:' | awk '{ print $3 }')
+ [[ -n ${version_llvm_rust} ]] &&
version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
+ [[ -z ${version_llvm_rust} ]] && die "Failed to read
used LLVM version from rustc!"
+
+ if ver_test "${version_lld}" -ne "${version_llvm_rust}"
; then
+ eerror "Rust is using LLVM version
${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}."
+ eerror "You will be unable to link
${CATEGORY}/${PN}. To proceed you have the following options:"
+ eerror " - Manually switch rust version using
'eselect rust' to match used LLVM version"
+ eerror " - Switch to
dev-lang/rust[system-llvm] which will guarantee matching version"
+ eerror " - Build ${CATEGORY}/${PN} without
USE=lto"
+ die "LLVM version used by Rust
(${version_llvm_rust}) does not match with ld.lld version (${version_lld})!"
+ fi
+ fi
+
python-any-r1_pkg_setup
# Avoid PGO profiling problems due to enviroment leakage