Bug 1522614 - Pass CC/CXX/CFLAGS/CXXFLAGS/AR down to cargo on Windows. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 05 Feb 2019 21:43:28 +0000
changeset 457329 e4074649d75f639011bd5e5b21f186eb033200b3
parent 457328 06b6f5ce09bc465d85dffef9e23d32ad549f9bc8
child 457330 3171519994129362108b5077061e595326651aea
push id35506
push useropoprus@mozilla.com
push dateWed, 06 Feb 2019 09:47:29 +0000
treeherdermozilla-central@2853480ed90d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1522614
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1522614 - Pass CC/CXX/CFLAGS/CXXFLAGS/AR down to cargo on Windows. r=froydnj Now that Make invokes cargo without going through an msys shell, environment variables are going to be preserved properly, and we can now "safely" pass the compiler-related variables down to cargo on Windows. This makes rust target builds use the expected compiler and flags, instead of the cc-rs crate guessing, picking cl.exe, and using the wrong one, with the build later failing when linking it all together because one of the objects is not for the right target. Interestingly, the lmdb code is today built for the wrong target on aarch64, but somehow, it doesn't break the build on automation, presumably because the lmdb code is actually dead code, and the linker eliminates the object as unused, masking the problem. Depends on D18186 Differential Revision: https://phabricator.services.mozilla.com/D18187
config/makefiles/rust.mk
--- a/config/makefiles/rust.mk
+++ b/config/makefiles/rust.mk
@@ -87,28 +87,21 @@ ifndef FUZZING_INTERFACES
 # what cargo chooses and there's no way to control cargo's selection, so we just have to
 # hope that if something needs to build a host C source file it can find a usable compiler!
 #
 # We're passing these for consumption by the `cc` crate, which doesn't use the same
 # convention as cargo itself:
 # https://github.com/alexcrichton/cc-rs/blob/baa71c0e298d9ad7ac30f0ad78f20b4b3b3a8fb2/src/lib.rs#L1715
 rust_cc_env_name := $(subst -,_,$(RUST_TARGET))
 
-ifeq (WINNT,$(HOST_OS_ARCH))
-# Don't do most of this on Windows because msys path translation makes a mess of the paths, and
-# we put MSVC in PATH there anyway.  But we do suppress warnings, since all such warnings
-# are in third-party code.
-export CFLAGS_$(rust_cc_env_name)=-w
-else
 export CC_$(rust_cc_env_name)=$(CC)
 export CXX_$(rust_cc_env_name)=$(CXX)
 export CFLAGS_$(rust_cc_env_name)=$(COMPUTED_CFLAGS)
 export CXXFLAGS_$(rust_cc_env_name)=$(COMPUTED_CXXFLAGS)
 export AR_$(rust_cc_env_name)=$(AR)
-endif # WINNT
 endif # FUZZING_INTERFACES
 endif # MOZ_CODE_COVERAGE
 endif # MOZ_UBSAN
 endif # MOZ_TSAN
 endif # MOZ_ASAN
 
 export CARGO_TARGET_DIR
 export RUSTFLAGS