[m-dev.] Cross-Compiling for Android

Peter Wang novalazy at gmail.com
Wed Apr 8 14:52:31 AEST 2020


On Sat, 04 Apr 2020 17:22:28 -0400, null at nowhere-dense.com wrote:
> Hello,
> 
> I wrote a small script to build Mercury cross-compilers for Android: 
> https://github.com/mephistopheles-8/mercury-cross-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 
> manually).
> 
> I am wondering now: Is it possible to build the test suite without 
> running it?

Hi Mark,

You could hack the %.out and %.res rules in tests/Mmake.common
to not run the built executable, and to not compare the .out file
with the .exp* files.

You might be able to use binfmt_misc to transparently run the test suite
under QEMU. Perhaps you've tried it already.

Peter


More information about the developers mailing list