CMake configuration for cross building for Android #9174

Merged
merged 3 commits into from Feb 22, 2017

Projects

None yet

4 participants

@qmfrederik
Contributor

This PR adds CMake files which support cross building for Android.
You can cross-build assuming ROOTFS_DIR points to the sysroot folder for the toolchain which was generated by Android. That is, we assume the toolchain can be found in ${ROOTFS_DIR}/../bin.

I've placed them in cross/android/arm64.

You can then use a command like:

CONFIG_DIR=`realpath cross/android/arm64` ROOTFS_DIR=`realpath cross/android/toolchain/arm64/sysroot` ./build.sh cross arm64 skipgenerateversion skipmscorlib cmakeargs -DENABLE_LLDBPLUGIN=0

to cross-compile for Android.

I'll create a PR for scripts that can generate the toolchain shortly.

@qmfrederik
Contributor

/cc @janvorli

@@ -0,0 +1,128 @@
+# Need to verify this
+SET( HAVE_COMPATIBLE_EXP_EXITCODE
@janvorli
janvorli Jan 27, 2017 Member

I assume these constants were tested on Android and not just copied from their Linux versions, right?

@cydhaselton
cydhaselton Jan 28, 2017

I ran the test you posted here for HAVE_COMPATIBLE_EXP_EXITCODE on-device; it's correct for Android API level 22 but could need testing for other levels, if possible

@qmfrederik
qmfrederik Jan 30, 2017 Contributor

I will double check this - @cydhaselton do you still have a termux environment where you can invoke the CoreCLR build scripts on an Android device?

@cydhaselton
cydhaselton Feb 5, 2017

@qmfrederik Apologies for late response; answer is yes.

@qmfrederik
qmfrederik Feb 7, 2017 Contributor

@cydhaselton Could you paste the contents of bin/obj/Linux.arm64.Debug/CMakeCache.txt in pastbin? That would allow me to verify the contents of this files with what you're seeing in the Termux environment.

@cydhaselton
cydhaselton Feb 11, 2017

@qmfrederik Yes. Just let me know if there's a particular branch you want me to clone to device and I'll get you the results

@qmfrederik
qmfrederik Feb 11, 2017 Contributor

@cydhaselton I think the best would be to run it on vanilla coreclr/master

@cydhaselton
cydhaselton Feb 16, 2017

Link to CMakeCache.txt file: http://pastebin.com/pYChxXS1
From vanilla coreclr/master

qmfrederik added some commits Jan 27, 2017
@qmfrederik qmfrederik Configuration files for cross building for Android arm64 82e2199
@qmfrederik qmfrederik Simplify toolchain script 787a312
@qmfrederik qmfrederik Fix trymake values for Android
2118579
@qmfrederik
Contributor

@janvorli I updated the values in tryrun.cmake with the values that @cydhaselton obtained on his Android device. Can you let me know whether we're good with this PR?

@cydhaselton There are a couple of other PRs pending in CoreCLR that should fix issues with 64-bit ARM; once they come through, things should start looking good for .NET Core on Android :)

@janvorli

LGTM, thank you!

@janvorli
Member

@dotnet-bot test this please

@qmfrederik
Contributor

@janvorli Is this one good to go?

@janvorli
Member

@qmfrederik I am sorry again for this going out of my radar.

@janvorli janvorli merged commit 09fd5fb into dotnet:master Feb 22, 2017

13 checks passed

CentOS7.1 x64 Debug Build and Test Build finished.
Details
FreeBSD x64 Checked Build Build finished.
Details
Linux ARM Emulator Cross Debug Build Build finished.
Details
Linux ARM Emulator Cross Release Build Build finished.
Details
OSX x64 Checked Build and Test Build finished.
Details
Ubuntu x64 Checked Build and Test Build finished.
Details
Ubuntu x64 Formatting Build finished.
Details
Windows_NT arm Cross Debug Build Build finished.
Details
Windows_NT arm Cross Release Build Build finished.
Details
Windows_NT x64 Debug Build and Test Build finished.
Details
Windows_NT x64 Formatting Build finished.
Details
Windows_NT x64 Release Priority 1 Build and Test Build finished.
Details
Windows_NT x86 Checked Build and Test Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment