Closed Bug 1288442 Opened 8 years ago Closed 7 years ago

modify android.m4 to use the proper clang flags

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: froydnj, Assigned: froydnj)

References

Details

Attachments

(2 files)

For cross-compilation, we have to pass a --target flag to LLVM and we have to tell it where to find a GCC-compatible toolchain (presumably for the linker, assembler, etc.). clang also handles adding directories to the include search path slightly differently than GCC does, so we need to compensate for that as well.
I think you were saying at one point that you had plans to automagically detect --target for clang, but if that isn't going to land anytime soon, I'd like to get this patch in-tree so that other people can experiment with clang on android. The -isystem changes are needed in any event.
Attachment #8773312 - Flags: review?(mh+mozilla)
Blocks: 1163171
Comment on attachment 8773312 [details] [diff] [review] modify android.m4 to use the proper clang flags Review of attachment 8773312 [details] [diff] [review]: ----------------------------------------------------------------- ::: build/autoconf/android.m4 @@ +67,5 @@ > AC_MSG_ERROR([not found. Please check your NDK. With the current configuration, it should be in $android_platform]) > fi > > + if test "$CC_TYPE" = "clang"; then > + extra_opts="--target=${llvm_target} -gcc-toolchain $(dirname $(dirname $TOOLCHAIN_PREFIX))" Adding --target here is conflicting with the changes from bug 1288313.
Attachment #8773312 - Flags: review?(mh+mozilla)
Compiling with clang using the NDK requires extra flags to be passed, compared to GCC, and some of the flags passed to GCC don't work with clang.
Attachment #8778463 - Flags: review?(mh+mozilla)
Comment on attachment 8778463 [details] [diff] [review] modify android.m4 to use the proper flags for compiling with clang Review of attachment 8778463 [details] [diff] [review]: ----------------------------------------------------------------- ::: build/moz.configure/android-ndk.configure @@ +155,5 @@ > + if c_compiler.type == 'clang': > + return ['-isystem', > + os.path.join(platform_dir, 'usr', 'include'), > + '-gcc-toolchain', > + toolchain] This kind of touches bug 1293543, and I need to give that some thought before saying anything here. ::: build/moz.configure/toolchain.configure @@ +742,5 @@ > +@depends('--disable-compile-environment', build_project, gonkdir, '--help') > +def compiling_android(compile_env, build_project, gonkdir, _): > + return compile_env and (gonkdir or build_project in ('mobile/android', 'js')) > + > +include_when('android-ndk.configure', when=compiling_android) This needs to be included before --with-toolchain-prefix is defined, because of the imply_option. I'd expect this to break on a try build, if it doesn't, there's a bug in python configure.
Attachment #8778463 - Flags: review?(mh+mozilla)
We're going to address this as part of bug 1163171, because it's a bit tricky to do this *without* switching over to clang wholesale.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: