Bug 1437201 - Part 1: Don't try to use target as host with clang for Android. r=froydnj
☠☠ backed out by b2c88b9c12f7 ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Fri, 09 Feb 2018 14:32:28 -0800
changeset 403246 04e61046bb4414859f2ecfe3ed7ddd5b53910274
parent 403245 fb2346dcaa2a5b7141b703ac0fe5a7ae98158f56
child 403247 1a206d390b011275f5eb719e6e5f74028d4ebc8d
push id59410
push usernalexander@mozilla.com
push dateFri, 09 Feb 2018 23:30:02 +0000
treeherderautoland@1a206d390b01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1437201
milestone60.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 1437201 - Part 1: Don't try to use target as host with clang for Android. r=froydnj The heuristic simply fails for clang as shipped in Android NDKs: those clang binaries can't target any non-Android host. MozReview-Commit-ID: 6AhOJxE3boW
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -774,31 +774,36 @@ def compiler(language, host_or_target, c
         )
 
     # Derive the host compiler from the corresponding target compiler when no
     # explicit compiler was given and we're not cross compiling. For the C++
     # compiler, though, prefer to derive from the host C compiler when it
     # doesn't match the target C compiler.
     # As a special case, since clang supports all kinds of targets in the same
     # executable, when cross compiling with clang, default to the same compiler
-    # as the target compiler, resetting flags.
+    # as the target compiler, resetting flags.  However, Android NDK clangs do
+    # not function as host compilers -- they're target compilers only -- so
+    # don't use clang target as host if the target OS is Android.
     if host_or_target == host:
         if other_c_compiler is not None:
             args = (c_compiler, other_c_compiler)
         else:
             args = ()
 
-        @depends(provided_compiler, other_compiler, cross_compiling, *args)
-        def provided_compiler(value, other_compiler, cross_compiling, *args):
+        @depends(provided_compiler, other_compiler, cross_compiling,
+                 target, *args)
+        def provided_compiler(value, other_compiler, cross_compiling,
+                              target, *args):
             if value:
                 return value
             c_compiler, other_c_compiler = args if args else (None, None)
             if not cross_compiling and c_compiler == other_c_compiler:
                 return other_compiler
-            if cross_compiling and other_compiler.type == 'clang':
+            if cross_compiling and other_compiler.type == 'clang' and \
+                    target.os != 'Android':
                 return namespace(**{
                     k: [] if k == 'flags' else v
                     for k, v in other_compiler.__dict__.iteritems()
                 })
 
     # Normally, we'd use `var` instead of `_var`, but the interaction with
     # old-configure complicates things, and for now, we a) can't take the plain
     # result from check_prog as CC/CXX/HOST_CC/HOST_CXX and b) have to let