Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for Android 10+ Support #1026

Closed
Alexhuszagh opened this issue Sep 21, 2022 · 11 comments
Closed

Tracking Issue for Android 10+ Support #1026

Alexhuszagh opened this issue Sep 21, 2022 · 11 comments
Assignees
Labels
A-android Area: android targets enhancement tracking-issue Issue to track progress for a certain feature/enhancement..

Comments

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Sep 21, 2022

Currently, our build process doesn't support custom Android NDK or system versions. I've been planning on slowly adding support based on using Docker build arguments. The draft PR is in #1023. Supporting newer Android versions is much more complex than just a version increment, and will also simplify our upgrade process with breaking version upgrades.

The current logic for using a custom Android version in building a Docker image would be:

cargo build-docker-image aarch64-linux-android \
    --build-arg ANDROID_SDK=29 \
    --build-arg ANDROID_VERSION=10.0.0_r47 \
    --build-arg ANDROID_NDK=r25b

This process is somewhat difficult since we need a minimal build environment, since cloning the entire Android system is extremely large, and would make our images prohibitively large. Due to the interdependencies in Android, this can be quite complex. These will only be tested once except for the default version (which is tested in CI), and only on aarch64-linux-android.

The status of individual packages is Android SDK and NDK versions is provided here.

@Alexhuszagh Alexhuszagh added enhancement A-android Area: android targets tracking-issue Issue to track progress for a certain feature/enhancement.. labels Sep 21, 2022
@Alexhuszagh Alexhuszagh self-assigned this Sep 21, 2022
@Alexhuszagh
Copy link
Contributor Author

Android 11 (11.0.0_r48) is currently failing with:

out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
error: hardware/interfaces/automotive/occupant_awareness/aidl/Android.bp:1:1: unrecognized module type "aidl_interface"
error: hardware/interfaces/tests/extension/vibrator/aidl/Android.bp:1:1: unrecognized module type "aidl_interface"
error: hardware/interfaces/power/aidl/Android.bp:15:1: unrecognized module type "aidl_interface"
error: hardware/interfaces/light/aidl/Android.bp:1:1: unrecognized module type "aidl_interface"
error: hardware/interfaces/graphics/common/aidl/Android.bp:1:1: unrecognized module type "aidl_interface"
        /tmp/tmp.kfzToylCE8/hardware/interfaces/compatibility_matrices/build/vintf_compatibility_matrix.go:121 +0x282
android/soong/vintf-compatibility-matrix.(*vintfCompatibilityMatrixRule).GenerateAndroidBuildActions(0xc00633bb80, 0xd6bd80, 0xc03b4b0900)
        /tmp/tmp.kfzToylCE8/hardware/interfaces/compatibility_matrices/build/vintf_compatibility_matrix.go:140 +0x8d
android/soong/android.(*ModuleBase).GenerateBuildActions(0xc00633bb80, 0xd669e0, 0xc03a3d29c0)
        /tmp/tmp.kfzToylCE8/build/soong/android/module.go:1275 +0x759
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2.1(0xc0207ccd00, 0xc03a3d29c0)
        /tmp/tmp.kfzToylCE8/build/blueprint/context.go:2480 +0x8d
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2(0xc0207ccd00, 0x0)
        /tmp/tmp.kfzToylCE8/build/blueprint/context.go:2481 +0x336
github.com/google/blueprint.(*Context).parallelVisit.func1.1(0xc050d7fe40, 0xc0207ccd00, 0xc002196a80, 0xc002196a20)
        /tmp/tmp.kfzToylCE8/build/blueprint/context.go:1852 +0x30
created by github.com/google/blueprint.(*Context).parallelVisit.func1
        /tmp/tmp.kfzToylCE8/build/blueprint/context.go:1851 +0x124

@Alexhuszagh
Copy link
Contributor Author

I've added ANDROID_SYSTEM_COMPLETE which can be set to 1 to enable building the complete Android system, rather than just the minimal subset we use. It should be a more resilient build, but also take a massive amount of space.

@Alexhuszagh
Copy link
Contributor Author

Not sure if Android 12 support is going to be possible without major effort. It seems much more complex and the build system takes forever to test:

PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=aosp_arm64
android/soong/java.(*Module).compile(0xc0aadce000, 0xfc6dc0, 0xc0af624b40, 0xf8d860, 0xc0cca33740)
        /tmp/tmp.fE5gQeZs7P/build/soong/java/base.go:1244 +0x3ad5
android/soong/java.(*AndroidApp).dexBuildActions(0xc0aadce000, 0xfc6dc0, 0xc0af624b40, 0x0, 0x1)
        /tmp/tmp.fE5gQeZs7P/build/soong/java/app.go:473 +0x1aa
android/soong/java.(*AndroidApp).generateAndroidBuildActions(0xc0aadce000, 0xfc6dc0, 0xc0af624b40)
        /tmp/tmp.fE5gQeZs7P/build/soong/java/app.go:666 +0x89c
android/soong/java.(*AndroidApp).GenerateAndroidBuildActions(0xc0aadce000, 0xfc6dc0, 0xc0af624b40)
        /tmp/tmp.fE5gQeZs7P/build/soong/java/app.go:277 +0x65
android/soong/android.(*ModuleBase).GenerateBuildActions(0xc0aadce000, 0xfb6680, 0xc0b432c750)
        /tmp/tmp.fE5gQeZs7P/build/soong/android/module.go:1850 +0xc5f
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2.1(0xc03ce73180, 0xc0b432c750)
        /tmp/tmp.fE5gQeZs7P/build/blueprint/context.go:2835 +0x85
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2(0xc03ce73180, 0xc07b7061e0, 0x0)
        /tmp/tmp.fE5gQeZs7P/build/blueprint/context.go:2836 +0x345
github.com/google/blueprint.parallelVisit.func1.1(0xc0aaca9f80, 0xc03ce73180, 0xc07b7061e0, 0xc07b706180, 0xc07b706120)
        /tmp/tmp.fE5gQeZs7P/build/blueprint/context.go:1973 +0x3a
created by github.com/google/blueprint.parallelVisit.func1
        /tmp/tmp.fE5gQeZs7P/build/blueprint/context.go:1972 +0x12e


16:33:08 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Sep 23, 2022

Currently building binaries with the r25b NDK fails (libraries work fine) with ld: error: unable to find library -lgcc, no matter if gcc or clang is used. libgcc also does not exist anymore, and the target spec does not seem to need libgcc. See aarch64_linux_android.rs, android_base.rs, and linux_base.rs.

We might actually need a newer SDK version for this, since it seems like libgcc is no longer packaged (this seems to be linked to android/ndk#1231 (comment)).

@Alexhuszagh Alexhuszagh changed the title Tracking Issue for Android 10 Support Tracking Issue for Android 10+ Support Sep 23, 2022
@Alexhuszagh
Copy link
Contributor Author

Android 10.x fails during runtime due to a broken symbolic link from system/bin/linker64 to /apex/com.android.runtime/bin/linker64. This might require building apex in 10.x, which we normally only do in 11+, so this might be fixable.

@Alexhuszagh
Copy link
Contributor Author

Ok this is an issue with r23 beta and up for the SDK:
rust-mobile/ndk#149

We probably need some sort of symlink or trick to get this to work.

@Emilgardis
Copy link
Member

would it suffice to just use build-std in ndk > 21 / when gcc is dropped?

@Alexhuszagh
Copy link
Contributor Author

Don't think so, since the issue is in the now-removed flags for https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/aarch64_linux_android.rs. That is, this will be fixed in new Rust versions, but since we need backwards compatibility, we need a symlink likely.

@Alexhuszagh
Copy link
Contributor Author

Looks like Android 10+ requires system/apex, which requires frameworks/base, which is gigantic and takes forever (and probably draws in a myriad of dependencies). I'll see if I can do anything to patch that.

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Oct 25, 2022

Android 10 works using the bootstrap linker as of 4169655.

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Nov 25, 2022

Closing since #1023 has been added and supporting Android versions 12-13 is extremely difficult since it seems impossible to separate the APEX linker from the Android build, which would require at least 60+GBs for builds and likely gigantic image sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-android Area: android targets enhancement tracking-issue Issue to track progress for a certain feature/enhancement..
Projects
None yet
Development

No branches or pull requests

2 participants