[m-dev.] Cross-Compiling for Android

null at nowhere-dense.com null at nowhere-dense.com
Sun Apr 5 07:22:28 AEST 2020


I wrote a small script to build Mercury cross-compilers for Android: 

The process went more smoothly than I had expected, though I would not 
use this for anything serious without careful testing. Feel free to 
provide feedback.

I have only attempted to build the hlc.gc grade.  I was finally able to 
test it with the 2020-03-29 ROTD and it still seems to work.
- mmc: mmc-DEV, built from 2020-03-28
- host: linux_x86_64
- target: armv7a, Android 5.1.1
- NDK: android-ndk-r20b
- SDK Version: 21

I tested statically linked binaries for other architectures with QEMU 
and they also appeared to work (a good sign, though real devices would 
be better).

I see that there has been a change to fetch clang version.  This fixes 
an error parsing the Mercury.config file, though be advised that 
`-dumpversion` would output the "equivalent" GCC version for older 
versions of Clang (like the ones included in the NDK).  I am not sure if 
there is a reliable solution for retrieving the clang version when 
cross-compiling with older clang versions (aside from setting it 

I am wondering now: Is it possible to build the test suite without 
running it?


More information about the developers mailing list