Bug 1380381 - Set rust debuginfo=1 for cross-OSX builds; r=glandium draft
authorMike Shal <mshal@mozilla.com>
Thu, 13 Jul 2017 18:49:10 -0400
changeset 608645 b856426eff5e093a0837d32a181bd28de27d8823
parent 606787 b07db5d650b7056c78ba0dbc409d060ec4e922cd
child 637378 4782001cff7fe78ce0c79c0575e7c98c78008539
push id68359
push userbmo:mshal@mozilla.com
push dateThu, 13 Jul 2017 23:23:12 +0000
reviewersglandium
bugs1380381, 1301751
milestone56.0a1
Bug 1380381 - Set rust debuginfo=1 for cross-OSX builds; r=glandium This is similar to bug 1301751, where something in rust seems to trigger errors running dsymutil to generate debug symbols in OSX. We can set debuginfo=1 for these builds as a temporary workaround for now, while we work on a more permanent solution in rust and/or dsymutil. debuginfo=1 still gives us enough info for stack traces, although without line info. debuginfo=2 would be useful for debugging, but is irrelevant to crash reports. MozReview-Commit-ID: DdA00GzVfWg
config/rules.mk
python/mozbuild/mozbuild/frontend/emitter.py
toolkit/library/gtest/rust/Cargo.toml
toolkit/library/rust/Cargo.toml
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -901,20 +901,28 @@ rust_unlock_unstable =
 ifdef MOZ_RUST_SIMD
 rust_unlock_unstable += RUSTC_BOOTSTRAP=1
 endif
 
 ifdef MOZ_USING_SCCACHE
 sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
 endif
 
+# XXX hack to work around dsymutil failing on cross-OSX builds (bug 1380381)
+ifeq ($(HOST_OS_ARCH)-$(OS_ARCH),Linux-Darwin)
+rust_debug_info=1
+else
+rust_debug_info=2
+endif
+
 define RUN_CARGO
 env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
 	RUSTC=$(RUSTC) \
+	RUSTFLAGS='-C debuginfo=$(rust_debug_info)' \
 	MOZ_SRC=$(topsrcdir) \
 	MOZ_DIST=$(ABS_DIST) \
 	LIBCLANG_PATH="$(MOZ_LIBCLANG_PATH)" \
 	CLANG_PATH="$(MOZ_CLANG_PATH)" \
 	PKG_CONFIG_ALLOW_CROSS=1 \
 	RUST_BACKTRACE=1 \
 	MOZ_TOPOBJDIR=$(topobjdir) \
 	$(2) \
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -465,27 +465,25 @@ class TreeMetadataEmitter(LoggingMixin):
                     context)
 
             # gkrust and gkrust-gtest must have the exact same profile settings
             # for our almost-workspaces configuration to work properly.
             if libname in ('gkrust', 'gkrust-gtest'):
                 if profile_name == 'dev':
                     expected_profile = {
                         'opt-level': 1,
-                        'debug': True,
                         'rpath': False,
                         'lto': False,
                         'debug-assertions': True,
                         'codegen-units': 4,
                         'panic': 'abort',
                     }
                 else:
                     expected_profile = {
                         'opt-level': 2,
-                        'debug': True,
                         'rpath': False,
                         'lto': True,
                         'debug-assertions': False,
                         'panic': 'abort',
                     }
 
                 if profile != expected_profile:
                     raise SandboxValidationError(
--- a/toolkit/library/gtest/rust/Cargo.toml
+++ b/toolkit/library/gtest/rust/Cargo.toml
@@ -28,22 +28,20 @@ doctest = false
 bench = false
 doc = false
 plugin = false
 harness = false
 
 # Explicitly specify what our profiles use.
 [profile.dev]
 opt-level = 1
-debug = true
 rpath = false
 lto = false
 debug-assertions = true
 codegen-units = 4
 panic = "abort"
 
 [profile.release]
 opt-level = 2
-debug = true
 rpath = false
 lto = true
 debug-assertions = false
 panic = "abort"
--- a/toolkit/library/rust/Cargo.toml
+++ b/toolkit/library/rust/Cargo.toml
@@ -26,22 +26,20 @@ doctest = false
 bench = false
 doc = false
 plugin = false
 harness = false
 
 # Explicitly specify what our profiles use.
 [profile.dev]
 opt-level = 1
-debug = true
 rpath = false
 lto = false
 debug-assertions = true
 codegen-units = 4
 panic = "abort"
 
 [profile.release]
 opt-level = 2
-debug = true
 rpath = false
 lto = true
 debug-assertions = false
 panic = "abort"