cross icon indicating copy to clipboard operation
cross copied to clipboard

Allow different Android versions for Docker images.

Open Alexhuszagh opened this issue 3 years ago • 1 comments

Allow different Android NDK, SDK, and Android versions to be used. Also simplifies the build process and future-proofs it slightly, since it removes the Python dependency for the Android NDK build script, and plans for the deprecation of the Makefile build process for the Android system build script.

Alexhuszagh avatar Sep 15 '22 16:09 Alexhuszagh

Currently only tested on 9.0.0_r1, needs testing on a few more versions:

  • [x] 5.0.0_r1
  • [x] 5.1.1_r38
  • [x] 6.0.1_r81
  • [x] 7.0.0_r36
  • [x] 8.0.0_r51
  • [x] 8.1.0_r81
  • [x] 9.0.0_r1
  • [x] 10.0.0_r47
  • [x] 11.0.0_r48
  • [ ] 12.1.0_r27
  • [ ] 13.0.0_r6

This should also simplify migrating to newer Android NDK and SDK versions in the future. This will also need a wiki entry, I believe.

I've also tested the Android NDK versions:

  • [x] r10e (version 5.0.0_r1 only)
  • [x] r13b (version 5.0.0_r1 only)
  • [x] r21d
  • [x] r25b

Also, the ANDROID_SYSTEM_COMPLETE isn't tested, nor will it, since the entire build requires ~100GB of memory and the build process is glacial. Note that we cannot use Android 7.1 builds, since they require API level 25, which does not seem to be supported by most (any?) NDK versions.

We also have added ANDROID_SYSTEM_NONE, for a very lightweight image without any runners.

Alexhuszagh avatar Sep 15 '22 16:09 Alexhuszagh

bors try --target aarch64-linux-android

Alexhuszagh avatar Sep 22 '22 17:09 Alexhuszagh

try

Build failed:

bors[bot] avatar Sep 22 '22 17:09 bors[bot]

bors try --target aarch64-linux-android

Alexhuszagh avatar Sep 22 '22 19:09 Alexhuszagh

try

Build succeeded:

bors[bot] avatar Sep 22 '22 19:09 bors[bot]

I've restored using Python for the Android NDK install steps, since it's a bit more resilient than making all the symlinks outself manually. We could probably speed it up slightly making manual symlinks, but considering the major bottleneck is the Android build itself, and this adds no size to the resulting image, I don't see any reason to remove it. I've added python3 since newer Android NDK versions use it by default and it also has effectively no change in the build times or performance.

Alexhuszagh avatar Sep 23 '22 16:09 Alexhuszagh

bors try --target aarch64-linux-android

Alexhuszagh avatar Sep 23 '22 16:09 Alexhuszagh

try

Build succeeded:

bors[bot] avatar Sep 23 '22 16:09 bors[bot]

bors try -android

Alexhuszagh avatar Oct 28 '22 02:10 Alexhuszagh

bors try- bors try --target -android

Alexhuszagh avatar Oct 28 '22 02:10 Alexhuszagh

bors try-

Alexhuszagh avatar Oct 28 '22 02:10 Alexhuszagh

bors try --target -android

Alexhuszagh avatar Oct 28 '22 03:10 Alexhuszagh

There might be other things I'm missing: I've tried to run through this numerous times, but at 4k lines of code, there may be something I've overlooked. I've re-run the tests for the entire suite of Android versions on aarch64-linux-android on the latest version of the build scripts, so it should work for the tested versions for all targets, but there could be subtle logic errors.

Alexhuszagh avatar Oct 28 '22 03:10 Alexhuszagh

try

Build succeeded:

bors[bot] avatar Oct 28 '22 04:10 bors[bot]

since these scripts are very android specific and most of it would not be used in CI, would it make sense to move this to cross-toolchain?

Emilgardis avatar Oct 28 '22 06:10 Emilgardis

since these scripts are very android specific and most of it would not be used in CI, would it make sense to move this to cross-toolchain?

Sure, that could work. We can then also cherry pick pieces if we say, want to upgrade to Android 11.

Alexhuszagh avatar Oct 28 '22 13:10 Alexhuszagh

If we do migrate this to cross-toolchains, it would be nice if we could have some basic CI to test the additions, however: https://github.com/cross-rs/cross-toolchains/pull/24

Alexhuszagh avatar Oct 28 '22 14:10 Alexhuszagh

I've updated the NDK to r25b. bors try --target -android

Alexhuszagh avatar Nov 01 '22 12:11 Alexhuszagh

try

Build succeeded:

bors[bot] avatar Nov 01 '22 13:11 bors[bot]

bors r=Emilgardis

Alexhuszagh avatar Nov 01 '22 13:11 Alexhuszagh

Build failed:

bors[bot] avatar Nov 01 '22 14:11 bors[bot]

Currently waiting on the fix for -ar and -gcc-ar in #1105, and also we had a spurious network issue in the merge.

Alexhuszagh avatar Nov 01 '22 14:11 Alexhuszagh

bors r+ p=1

Emilgardis avatar Nov 01 '22 14:11 Emilgardis

Build failed:

bors[bot] avatar Nov 01 '22 15:11 bors[bot]

bors retry

Emilgardis avatar Nov 01 '22 16:11 Emilgardis

bors r=Emilgardis

Alexhuszagh avatar Nov 01 '22 16:11 Alexhuszagh

Already running a review

bors[bot] avatar Nov 01 '22 16:11 bors[bot]

Build succeeded:

bors[bot] avatar Nov 01 '22 17:11 bors[bot]