ring icon indicating copy to clipboard operation
ring copied to clipboard

NDK 23 RC missing aarch64-linux-android-ar

Open MateusAmin opened this issue 4 years ago • 9 comments

aarch64-linux-android-ar -> aarch64-linux-android-as

Workarounds: use NDK 22, copy android30-clang(?) to -ar, update mk/cargo.sh line 50 to use as or ???.

Long term I feel like there is a naming pattern here that can be taken advantage of here or in a more robust way...

Or there is something obvious going over my head. Thanks for your time and efforts!

MateusAmin avatar Feb 22 '21 19:02 MateusAmin

Hi, are you sure? Usually as is the assembler and ar is the archiver (library manager) and usually both exist.

briansmith avatar Feb 26 '21 19:02 briansmith

You are correct.

I suppose the archiver aarch64-linux-android-ar is simply missing in NDK 23 rc prebuilts. I only see llvm-ar.

The changelog for NDK 23 is here

MateusAmin avatar Mar 03 '21 18:03 MateusAmin

When mk/cargo.sh does "${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" ndk-bundle, it seems to be installing NDK 22 based on the log https://github.com/briansmith/ring/runs/1991696699?check_suite_focus=true: "Downloading android-ndk-r22-linux".

I would be happy if you or somebody could update mk/install-build-tools.sh to install NDK 23 instead, Perhaps we shouldn't be using ndk-bundle as the parameter to sdkmanager? Or maybe we should be doing something else? I would love it if mk/install-build-tools installed a hard-coded version of the NDK.

If you can update the mk/install-build-tools.sh script to install NDK 23, then I can help you figure out the rest.

briansmith avatar Mar 03 '21 20:03 briansmith

I'm going to close this for now since I see that NDK 23 is still in beta. Once it has a final release we can explore how to deal with it, if any changes are needed.

briansmith avatar Mar 08 '21 23:03 briansmith

@briansmith now NDK23 has entered LTS

onichandame avatar Jan 12 '22 14:01 onichandame

@briansmith now NDK23 has entered LTS

I think it is unlikely that NDK 23 is missing the -ar executable. Maybe we need to invoke it differently.

I think we should update the ring CI/CD to the latest stable release (maybe newer than 23?) and make the necessary changes to the CI/CD scripts to keep things working. This will help people understand what they need to do in their own build scripts.

briansmith avatar Jan 12 '22 23:01 briansmith

Individual arch *ar binary has been removed from NDK 23+.

To fix copy and rename llvm-ar to aarch64-linux-android-ar in ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/{SYSTEM}/bin

OR

set this env var:

AR_aarch64_linux_android=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/{SYSTEM}/bin/llvm-ar

Doing this for all target arch fixed the issue.

irediaes avatar Mar 23 '22 09:03 irediaes

@irediaes Thanks for that info. That sounds great.

In ring's CI/CD, mk/cargo.sh has this:

   aarch64-linux-android)
    export CC_aarch64_linux_android=$android_tools/aarch64-linux-android21-clang
    export AR_aarch64_linux_android=$android_tools/aarch64-linux-android-ar
    export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$android_tools/aarch64-linux-android21-clang
    ;;

and this:

  armv7-linux-androideabi)
    export CC_armv7_linux_androideabi=$android_tools/armv7a-linux-androideabi18-clang
    export AR_armv7_linux_androideabi=$android_tools/arm-linux-androideabi-ar
    export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$android_tools/armv7a-linux-androideabi18-clang
    ;;

I would love a PR that upgrades the NDK in ring's CI/CD to the latest stable/final NDK release and makes the changes to mk/cargo.sh suggested by @irediaes. This way, we can document the proper way of building with the new NDK.

briansmith avatar Apr 06 '22 19:04 briansmith

I reopened this issue to track the need to update the documentation (mk/cargo.sh presently) and CI/CD to use the latest NDK.

briansmith avatar Apr 06 '22 19:04 briansmith

The commit titled "Use Android NDK 25 and work around Rust/Android incompatibilities." in PR #1522 addresses this by using @irediaes's second suggestion.

briansmith avatar Oct 19 '22 22:10 briansmith