Description of the bug:
Hi, all.
We recently upgraded to bazel 7.0.2 which according to this post, enabled android platforms for use: https://blog.bazel.build/2023/11/15/android-platforms.html
I am cross compiling android apps with the following bazel rc flags:
common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64_android_ndk
build --@io_bazel_rules_kotlin//kotlin/settings:jvm_emit_jdeps=False
I am noticing an issue with a maven dependency:
"com.github.gkonovalov.android-vad:webrtc:2.0.6",
This command below:
cd /home/ankit/.cache/bazel/_bazel_ankit/7bf1254182ebae36d2817c38fe27106c/sandbox/linux-sandbox/7401/execroot/mosaic && \
exec env - \
GTEST_COLOR=1 \
INVALIDATE_BAZEL_CACHE_COUNTER=4 \
PATH=/bin:/usr/bin:/usr/local/bin \
TMPDIR=/tmp \
/home/ankit/.cache/bazel/_bazel_ankit/install/14fb027596f626f2526df4873ea20b8b/linux-sandbox -t 15 -w /dev/shm -w /home/ankit/.cache/bazel/_bazel_ankit/7bf1254182ebae36d2817c38fe27106c/sandbox/linux-sandbox/7401/execroot/mosaic -w /opt/.qnx -w /tmp -e /tmp -S /home/ankit/.cache/bazel/_bazel_ankit/7bf1254182ebae36d2817c38fe27106c/sandbox/linux-sandbox/7401/stats.out -N -D /home/ankit/.cache/bazel/_bazel_ankit/7bf1254182ebae36d2817c38fe27106c/sandbox/linux-sandbox/7401/debug.out -- bazel-out/linux_x86_64_platform-opt-exec/bin/external/bazel_tools/tools/android/aar_native_libs_zip_creator --input_aar external/maven/v1/https/jitpack.io/com/github/gkonovalov/android-vad/webrtc/2.0.6/webrtc-2.0.6.aar --cpu k8 --output_zip bazel-out/arm64_android_ndk-fastbuild-android-ST-8b67b3e599b1/bin/external/maven/_aar/com_github_gkonovalov_android_vad_webrtc/native_libs.zip
fails to compile with the following error;
AAR external/maven/v1/https/jitpack.io/com/github/gkonovalov/android-vad/webrtc/2.0.6/webrtc-2.0.6.aar missing native libs for requested architecture: k8
It looks like the offending line is the --cpu k8, and indeed when I cd'd into the bazel sandbox and ran the command with --cpu arm64-v8a it ran without error. I tracked down the offending line to:
|
.add("--cpu", ruleContext.getConfiguration().getCpu()) |
My code does work with the following bazelrc and platform mappings flags (e.g we have a workaround)
common --noincompatible_enable_android_toolchain_resolution
build --platform_mappings=tools/build/bazel.rc.d/platform_mappings
build --fat_apk_cpu arm64-v8a
# Uncomment the below lines to build for x86
# build --fat_apk_cpu x86_64
build --android_crosstool_top=@androidndk//:toolchain
build --@io_bazel_rules_kotlin//kotlin/settings:jvm_emit_jdeps=False
Platform mappings
flags:
# Android
# Mostly, native code is compiled after the android_binary rule has run a transition to compile for that platform.
# We just detect the transition, which sets "Android configuration distinguisher", and then translate the CPU it set.
--Android configuration distinguisher=android
--cpu=arm64-v8a
//:arm64_android_ndk
--Android configuration distinguisher=android
--cpu=x86_64
//:x86_64_android_ndk
We're hoping to get rid of this code soon, so wondering if I am missing something here.
We actually ran into this when we were on a bazel 7 pre-release and reported an issue here: bazelbuild/rules_android_ndk#39
Thanks in advance!
Which category does this issue belong to?
Android
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
On bazel 7, use android platforms, and attempt to compile the maven dependency:
"com.github.gkonovalov.android-vad:webrtc:2.0.6",
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
release 7.0.2
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I don't think this is a regression
Have you found anything relevant by searching the web?
We actually ran into this when we were on a bazel 7 pre-release and reported an issue here: bazelbuild/rules_android_ndk#39
Any other information, logs, or outputs that you want to share?
No response
Description of the bug:
Hi, all.
We recently upgraded to bazel 7.0.2 which according to this post, enabled android platforms for use: https://blog.bazel.build/2023/11/15/android-platforms.html
I am cross compiling android apps with the following bazel rc flags:
I am noticing an issue with a maven dependency:
This command below:
fails to compile with the following error;
It looks like the offending line is the --cpu k8, and indeed when I cd'd into the bazel sandbox and ran the command with --cpu arm64-v8a it ran without error. I tracked down the offending line to:
bazel/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java
Line 440 in 224d642
My code does work with the following bazelrc and platform mappings flags (e.g we have a workaround)
Platform mappings
We're hoping to get rid of this code soon, so wondering if I am missing something here.
We actually ran into this when we were on a bazel 7 pre-release and reported an issue here: bazelbuild/rules_android_ndk#39
Thanks in advance!
Which category does this issue belong to?
Android
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
On bazel 7, use android platforms, and attempt to compile the maven dependency:
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release?release 7.0.2
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD?Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I don't think this is a regression
Have you found anything relevant by searching the web?
We actually ran into this when we were on a bazel 7 pre-release and reported an issue here: bazelbuild/rules_android_ndk#39
Any other information, logs, or outputs that you want to share?
No response