tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] firefox: fix build with rust 1.45



rust 1.45 added an embed-bitcode flag which has some compatibility
issues with LTO[0]. This causes build failures in firefox like the
following:

  error: options `-C embed-bitcode=no` and `-C lto` are incompatible
  error: could not compile `gkrust`.

This is already fixed in upstream firefox in commits [1] and [2].
The second reverts the first in favor of a slightly different fix.
The -Cembed-bitcode=yes hunk is the only one actually necessary to
fix the build failure, so only that one file is patched.

[0] https://github.com/rust-lang/rust/blob/f173a4b/RELEASES.md#compatibility-notes
[1] https://hg.mozilla.org/mozilla-central/rev/bb79da633a2efe12f7a0a6e89d925961b8b444a7
[2] https://hg.mozilla.org/mozilla-central/rev/e5d2a6d5187b8f1420b65089c4d841ec29a42897
---
 www/firefox/distinfo                              |  2 +-
 .../patches/patch-config_makefiles_rust.mk        | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/www/firefox/distinfo b/www/firefox/distinfo
index 9629afb5f9d..6fcaeecf225 100644
--- a/www/firefox/distinfo
+++ b/www/firefox/distinfo
@@ -8,7 +8,7 @@ SHA1 (patch-aa) = 11060461fdaca5661e89651b8ded4a59d2abc4d7
 SHA1 (patch-browser_app_profile_firefox.js) = 89cea0a66457c96ad0b94aaa524aa5942ad781d0
 SHA1 (patch-build_moz.configure_rust.configure) = ee9e207e67709f3c9455b4d22f5f254890e99ca8
 SHA1 (patch-config_gcc-stl-wrapper.template.h) = 781a063fa6ab345face53fd88404ead11ab335b2
-SHA1 (patch-config_makefiles_rust.mk) = 8637cd3f56774648fd586c7ad8dd49e269b9eb2a
+SHA1 (patch-config_makefiles_rust.mk) = ffe12f9765a4dac3ee8c6b29416ffa6df6b14d0e
 SHA1 (patch-dom_base_nsAttrName.h) = ac7ba441a3b27df2855cf2673eea36b1cb44ad49
 SHA1 (patch-dom_media_CubebUtils.cpp) = 226821d961039ae5c9c50d8615757b73c6bcd80a
 SHA1 (patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp) = e458c9c8dc66edc69c1874734af28a77fc5e3993
diff --git a/www/firefox/patches/patch-config_makefiles_rust.mk b/www/firefox/patches/patch-config_makefiles_rust.mk
index 2739e3956d7..838bdb26046 100644
--- a/www/firefox/patches/patch-config_makefiles_rust.mk
+++ b/www/firefox/patches/patch-config_makefiles_rust.mk
@@ -3,6 +3,9 @@ $NetBSD: patch-config_makefiles_rust.mk,v 1.1 2020/04/30 19:08:50 maya Exp $
 NetBSD doesn't get along with parallel rust builds (it causes issues
 with ld.so) which are the default. Force -j1.
 
+Set -Cembed-bitcode=yes when using LTO to fix build with rust >= 1.45.
+Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1640982
+
 --- config/makefiles/rust.mk.orig	2020-04-03 19:34:34.000000000 +0000
 +++ config/makefiles/rust.mk
 @@ -52,6 +52,9 @@ endif
@@ -15,3 +18,15 @@ with ld.so) which are the default. Force -j1.
  
  # These flags are passed via `cargo rustc` and only apply to the final rustc
  # invocation (i.e., only the top-level crate, not its dependencies).
+@@ -62,6 +65,11 @@ ifndef MOZ_DEBUG_RUST
+ # gkrust_gtest.
+ ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
+ cargo_rustc_flags += -Clto
++endif
++# Versions of rust >= 1.45 need -Cembed-bitcode=yes for all crates when
++# using -Clto.
++ifeq (,$(filter 1.38.% 1.39.% 1.40.% 1.41.% 1.42.% 1.43.% 1.44.%,$(RUSTC_VERSION)))
++RUSTFLAGS += -Cembed-bitcode=yes
+ endif
+ endif
+ endif
-- 
2.28.0



Home | Main Index | Thread Index | Old Index