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
--- 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