(see tor-browser-build/projects/firefox/build). I do not know whether this would work also for Android, though.
./mach configure stops immediately when it tries to create a simple program to check that the compiler works.
The error was:
/var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld: error: cannot open /var/tmp/dist/clang/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-arm-android.a
here is full error that i get (when trying to just build for x86:
0:03.77 checking for executable suffix... configure: error: installation or configuration problem: compiler cannot create executables. 0:03.77 DEBUG: <truncated - see config.log for full output> 0:03.77 DEBUG: configure:878: /var/tmp/dist/clang/bin/clang -std=gnu99 --target=i686-linux-android -c -fno-short-enums -fno-exceptions -isystem /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/sysroot/usr/include/i686-linux-android -isystem /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/sysroot/usr/include -gcc-toolchain /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/x86-4.9/prebuilt/linux-x86_64 -D__ANDROID_API__=16 conftest.c 1>&5 0:03.77 DEBUG: configure:874:8: error: use of undeclared identifier '__MINGW32__' 0:03.77 DEBUG: return __MINGW32__; 0:03.77 DEBUG: ^ 0:03.77 DEBUG: 1 error generated. 0:03.77 DEBUG: configure: failed program was: 0:03.77 DEBUG: #line 871 "configure" 0:03.77 DEBUG: #include "confdefs.h" 0:03.77 DEBUG: 0:03.77 DEBUG: int main() { 0:03.77 DEBUG: return __MINGW32__; 0:03.77 DEBUG: ; return 0; } 0:03.77 DEBUG: configure:897: checking for executable suffix 0:03.77 DEBUG: configure:907: /var/tmp/dist/clang/bin/clang -std=gnu99 --target=i686-linux-android -o conftest -fno-short-enums -fno-exceptions -isystem /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/sysroot/usr/include/i686-linux-android -isystem /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/sysroot/usr/include -gcc-toolchain /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/x86-4.9/prebuilt/linux-x86_64 -D__ANDROID_API__=16 -L/var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/platforms/android-16/arch-x86/usr/lib -Wl,-rpath-link=/var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/platforms/android-16/arch-x86/usr/lib --sysroot=/var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/platforms/android-16/arch-x86 -gcc-toolchain /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/x86-4.9/prebuilt/linux-x86_64 -fuse-ld=bfd conftest.c 1>&5 0:03.77 DEBUG: /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld.bfd: cannot find /var/tmp/dist/clang/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-i686-android.a: No such file or directory 0:03.77 DEBUG: /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld.bfd: cannot find -l:libunwind.a 0:03.77 DEBUG: /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld.bfd: cannot find /var/tmp/dist/clang/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-i686-android.a: No such file or directory 0:03.77 DEBUG: /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld.bfd: cannot find -l:libunwind.a 0:03.77 DEBUG: clang-13: error: linker command failed with exit code 1 (use -v to see invocation) 0:03.77 DEBUG: configure: error: installation or configuration problem: compiler cannot create executables. 0:03.77 ERROR: old-configure failedCreating local state directory: /var/tmp/tmp.VNI9x7XdyS/.mozbuild/srcdirs/geckoview-c025288dbe5b-95d33a1f6213Error running mach: ['configure', '--with-tor-browser-version=testbuild', '--with-java-bin-path=/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin', '--without-wasm-sandboxed-libraries']The error occurred in code that was called by the mach command. This is eithera bug in the called code itself or in the way that mach is calling it.You can invoke |./mach busted| to check if this issue is already on file. If itisn't, please use |./mach busted file configure| to report it. If |./mach busted| ismisbehaving, you can also inspect the dependencies of bug 1543241.If filing a bug, please include the full output of mach, including this errormessage.The details of the failure are as follows:Exception: Process executed with non-0 exit code 1: ['/var/tmp/build/geckoview-c025288dbe5b/obj-i386-linux-android/_virtualenvs/build/bin/python', '/var/tmp/build/geckoview-c025288dbe5b/configure.py', '--with-tor-browser-version=testbuild', '--with-java-bin-path=/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin', '--without-wasm-sandboxed-libraries'] File "/var/tmp/build/geckoview-c025288dbe5b/python/mozbuild/mozbuild/build_commands.py", line 254, in configure return driver.configure( File "/var/tmp/build/geckoview-c025288dbe5b/python/mozbuild/mozbuild/controller/building.py", line 1528, in configure status = self._run_command_in_objdir( File "/var/tmp/build/geckoview-c025288dbe5b/python/mozbuild/mozbuild/base.py", line 855, in _run_command_in_objdir return self.run_process(cwd=self.topobjdir, **args) File "/var/tmp/build/geckoview-c025288dbe5b/python/mach/mach/mixin/process.py", line 174, in run_process raise Exception(
0:03.77 DEBUG: /var/tmp/dist/android-toolchain/android-sdk-linux/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld.bfd: cannot find /var/tmp/dist/clang/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-i686-android.a: No such file or directory
or just:
cannot find /var/tmp/dist/clang/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-i686-android.a: No such file or directory
Correct, we want libclang_rt.builtins-i686-android.a we built from 13.0.0.
is it expected that although we apparently already built libclang_rt.builtins-i686-android.a from llvm 13.0.0 it is nowhere to to be found in /var/dist at this point in the build? (ie: no artifacts from prior stages there?)
They mention a arm-linux-gnueabihf sysroot to use with QEMU in user space, which may be the most difficult part for us... (Though it seems that it is needed only for tests).
Other conjectures:
we can use the crosscompiler of the NDK (requirement: «clang executable with support for the ARM target»)
we could check if there is a way to create (part of) the NDK by ourselves, since the NDK contains the library we need
I have some LLVM/clang experience (I have messed up with libtooling and LLVM compilation in general), and I like this kind of stuff
I am 100% available to follow the guide I have linked, and I have some ideas.
However I do not know if I can produce something that is working for our needs
I think that we could at least cross-compile Clang for an ARM host.
I mean: install gcc-arm-linux-gnueabihf on a Debian container and use it to compile LLVM/Clang/compiler-rt/libcxx.
This must produce a working libclangrt-etc (at least gnueabi! I do not know whether we can compile for Android! But with the NDK we should be able to), but I fear it will increase compilation time by a lot.
You could pass only compiler-rt as the project to build, but this does not work...
@aguestuser I wanted to start a build because I thought it would take a lot... But actually it was super fast and I got a library for ARMv8! Probably we can get also the other libraries:
Now, from what I can understand from build-clang.py, Mozilla is building rt as a second step (first, they build only for x86_64, then they use it to compile again for all archs).
I have tried to build compiler-rt on my host, rather than a container, and encountered several difficulties.
I am investigating more on that however, to understand if we can do more like Mozilla.
My idea is that it is an expected error (on non-mingw environments).
I have the same error in my local builds.
A failure simply means that you are not using mingw .
If that's just the directory, maybe a for loop can work
No, I would need 3 possible parameters: architectures with two variants (e.g., I need to have both x86 and i686), and additional flags for the compiler (used only by 32-bit ARM).
I have found that it is possible to iterate over tuples, but having the function seems more clean to me at this point .
The rebase for v99 includes Clang 13.0.1, however:
it builds compiler-rt with the NDK's compiler, instead of using the just compiled one
its linker is not working on x86/x86_64
it cannot link some libraries that contain compressed symbols (I found a similar issue on the NDK)
we have never used lld to link Geckoview anyway (I think we should, but I cannot understand what Mozilla is currently doing, and in any case it may be a problem of $PATH priority and/or build environments)