-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
mobile-install: App on architecture arm64 with arm64-v8a abi could not find native library #2239
Comments
Thanks for the detailed report, I'm investigating now. |
Actually, would you mind trying to run your app via |
Hello, I understand it's quite a dirty work to deal with so many issues, so I try my best to describe it clear. I have checked with Two more things hope to provide more info.
But after I check the app directory on android device via
Notice the different names of abi directories under lib directory, either That's about it, thank you. |
Thanks for all of the details! I suspect the problem is due to a bug in Bazel using special code to handle native libs during Line 353 in c3f6a6a
It is very strange that this works for |
Turns out that the native libs were never incrementally installed because By switching it on, you can now use
I'll send a change to switch it on by default. |
Baseline: deb028e Cherry picks: + a3a5975: Fix a race condition in remote cache + b8d0e1b: Use a new GitHub token and KMS key for the release process. + 3759e38: remote: fix unexpected IO error (not a directory) + 4473bb1: Fix a race condition in Bazel's Windows process management. + 9137fb9: undo flag flip of --incompatible_strict_action_env + 12ab12e: Revert "Enabling Bazel to generate input symlinks as defined by RE AP? + 6345c74: Automated rollback of commit 30536ba. New features: - Add inputs filtering for aquery - https://docs.bazel.build now supports versioned documentation. Use the selector at the top of the navigation bar to switch between documentation for different Bazel releases. - build_tar.py in tools/build_defs/pkg now supports a json manifest that can be used to add paths that have symbols that can't be specified via the command line Important changes: - Added `--incompatible_dont_emit_static_libgcc` (#6825) Added `--incompatible_linkopts_in_user_link_flags` (#6826) - mobile-install now works with aapt2. Try it out with `bazel mobile-install --android_aapt=aapt2 //my:target` - Fixed a mobile-install v1 bug when deploying to Android 9 Pie devices. #6814 - Add a new option --xbinary_fdo to pass xbinary profile. - --runs_per_test: place in TESTING documentation category. - Adds a clarifying message to test case summary output when all test cases pass but the target fails. - Fixed mobile-install v1 error when installing an app with native libraries onto an Android 9 (Pie) device. See bazelbuild/examples#77 - Fixed issue where error messages from Android manifest merging actions were not propagated fully. - Add outputs and mnemonic filtering to aquery - New incompatible change flag for defaulting to aapt2 in Android builds: `--incompatible_use_aapt2_by_default`. To build with aapt2 today, pass the flag `--incompatible_use_aapt2_by_default=true` or `--android_aapt=aapt2`, or set the `aapt_version` to `aapt2` on your `android_binary` or `android_local_test` target. - set projectId in all PublishBuildToolEventStreamRequest - Flip flag --incompatible_string_is_not_iterable (#5830) - cc_toolchain.(static|dynamic)_runtime_libs attributes are now optional - Added --incompatible_disable_runtimes_filegroups (#6942). - objc_bundle has been removed. Please migrate to rules_apple's [apple_bundle_import](https://github.com/bazelbuild/rules_apple/bl ob/master/doc/rules-resources.md#apple_bundle_import). - The apple_stub_binary rule has been deleted. - Incompatible flag `--incompatible_dont_emit_static_libgcc` has been flipped (#6825) - Incompatible flag `--incompatible_linkopts_in_user_link_flags` has been flipped (#6826) - Open source aquery & cquery query2 tests - Fixed a mobile-install bug where `arm64-v8a` libraries were not deployed correctly on `arm64` devices. This was done by enabling incremental native lib deployment by default. A previously undocumented `--android_incremental_native_libs` flag is removed, and is now the regular behavior. See #2239 - Incompatible flag `--incompatible_linkopts_in_user_link_flags` has been flipped (#6826) - Incompatible flag `--incompatible_dont_emit_static_libgcc` has been flipped (#6825) - Added --incompatible_disable_legacy_crosstool_fields. See the migration notes at #6861. - In the Query HowTo, recommend ":*" instead of ":all". "all" might be the name of a target. - The default value for --incompatible_strict_action_env has been flipped to 'false' again, as we discovered breakages for local execution users. We'll need some more time to figure out the best way to make this work for local and remote execution. Follow #7026 for more details. This release contains contributions from many people at Google, as well as Benjamin Peterson, Dave Lee, George Gensure, Gert van Dijk, Gustavo Storti Salibi, Keith Smiley, Loo Rong Jie, Lukasz Tekieli, Mikhail Mazurskiy, Thi, Travis Cline, Vladimir Chebotarev, Yannic.
Baseline: deb028e Cherry picks: + a3a5975: Fix a race condition in remote cache + b8d0e1b: Use a new GitHub token and KMS key for the release process. + 3759e38: remote: fix unexpected IO error (not a directory) + 4473bb1: Fix a race condition in Bazel's Windows process management. + 9137fb9: undo flag flip of --incompatible_strict_action_env + 12ab12e: Revert "Enabling Bazel to generate input symlinks as defined by RE AP? + 6345c74: Automated rollback of commit 30536ba. New features: - Add inputs filtering for aquery - https://docs.bazel.build now supports versioned documentation. Use the selector at the top of the navigation bar to switch between documentation for different Bazel releases. - build_tar.py in tools/build_defs/pkg now supports a json manifest that can be used to add paths that have symbols that can't be specified via the command line Important changes: - Added `--incompatible_dont_emit_static_libgcc` (bazelbuild#6825) Added `--incompatible_linkopts_in_user_link_flags` (bazelbuild#6826) - mobile-install now works with aapt2. Try it out with `bazel mobile-install --android_aapt=aapt2 //my:target` - Fixed a mobile-install v1 bug when deploying to Android 9 Pie devices. bazelbuild#6814 - Add a new option --xbinary_fdo to pass xbinary profile. - --runs_per_test: place in TESTING documentation category. - Adds a clarifying message to test case summary output when all test cases pass but the target fails. - Fixed mobile-install v1 error when installing an app with native libraries onto an Android 9 (Pie) device. See bazelbuild/examples#77 - Fixed issue where error messages from Android manifest merging actions were not propagated fully. - Add outputs and mnemonic filtering to aquery - New incompatible change flag for defaulting to aapt2 in Android builds: `--incompatible_use_aapt2_by_default`. To build with aapt2 today, pass the flag `--incompatible_use_aapt2_by_default=true` or `--android_aapt=aapt2`, or set the `aapt_version` to `aapt2` on your `android_binary` or `android_local_test` target. - set projectId in all PublishBuildToolEventStreamRequest - Flip flag --incompatible_string_is_not_iterable (bazelbuild#5830) - cc_toolchain.(static|dynamic)_runtime_libs attributes are now optional - Added --incompatible_disable_runtimes_filegroups (bazelbuild#6942). - objc_bundle has been removed. Please migrate to rules_apple's [apple_bundle_import](https://github.com/bazelbuild/rules_apple/bl ob/master/doc/rules-resources.md#apple_bundle_import). - The apple_stub_binary rule has been deleted. - Incompatible flag `--incompatible_dont_emit_static_libgcc` has been flipped (bazelbuild#6825) - Incompatible flag `--incompatible_linkopts_in_user_link_flags` has been flipped (bazelbuild#6826) - Open source aquery & cquery query2 tests - Fixed a mobile-install bug where `arm64-v8a` libraries were not deployed correctly on `arm64` devices. This was done by enabling incremental native lib deployment by default. A previously undocumented `--android_incremental_native_libs` flag is removed, and is now the regular behavior. See bazelbuild#2239 - Incompatible flag `--incompatible_linkopts_in_user_link_flags` has been flipped (bazelbuild#6826) - Incompatible flag `--incompatible_dont_emit_static_libgcc` has been flipped (bazelbuild#6825) - Added --incompatible_disable_legacy_crosstool_fields. See the migration notes at bazelbuild#6861. - In the Query HowTo, recommend ":*" instead of ":all". "all" might be the name of a target. - The default value for --incompatible_strict_action_env has been flipped to 'false' again, as we discovered breakages for local execution users. We'll need some more time to figure out the best way to make this work for local and remote execution. Follow bazelbuild#7026 for more details. This release contains contributions from many people at Google, as well as Benjamin Peterson, Dave Lee, George Gensure, Gert van Dijk, Gustavo Storti Salibi, Keith Smiley, Loo Rong Jie, Lukasz Tekieli, Mikhail Mazurskiy, Thi, Travis Cline, Vladimir Chebotarev, Yannic.
…oyment of all native libs. This is the *correct* behavior for incremental deployment. This is already done for the dex and resource APK, now we're enabling it for native libs. Previously, the native libs were bundled directly into the incremental APK. The --android_incremental_native_libs flag was never documented, so we can safely remove it. Fixes bazelbuild/bazel#2239 RELNOTES: Fixed a mobile-install bug where `arm64-v8a` libraries were not deployed correctly on `arm64` devices. This was done by enabling incremental native lib deployment by default. A previously undocumented `--android_incremental_native_libs` flag is removed, and is now the regular behavior. See bazelbuild/bazel#2239 PiperOrigin-RevId: 226529911
Description of the problem
I want to build an android binary which rely on a native library, and expect it to run on an android 5.1 system whose architecture is arm64, A53 CPU.
So, I build this apk with commands:
bazel mobile-install --fat_apk_cpu=arm64-v8a --compilation_mode=opt <build file location>:<target name> --start_app -s
With
-s
option, every build command and its flags seem to be reasonable. But after building, the android device run the target apk with failure. From adb tool, I got the error log, which is:As far as I have known, the built apk file would contains native libs in separate directories which would be named according to the abis used by the native library. So I checked location
<apk name>/lib/arm64/
of installed android device for native library I built with bazel. In fact, I found the desired native dynamic library at this position, but I don't know why the intalled apk on android device could not found it.After I got the error log information, I knew it is because the apk did not find the native dynamic library in the directory where it should be. I manually
cp
the dynamic library into/system/lib64
, which is system library directory, and as the error log indicated. Then the apk could run and work on android device!So this is quite wired? is it because bazel pack the apk in a way that the android system could not recognize?
Minimal example
I built
examples/android/java/bazel:hello_world
in bazel source code directory with command:bazel mobile-install --fat_apk_cpu=arm64-v8a --compilation_mode=opt examples/android/java/bazel:hello_world --start_app -s
It reproduced the same situation as I have encountered. The App failed to run with log information:
I looked into the apk, and found the native dynamic library at position:
/data/app/bazel.android-1/lib/arm64/libhello_world.so
After I
cp libhello_world.so /system/lib64/
, I re-run the App, and it worked.Environment info
Operating System:
Ubuntu 14.04
NDK,SDK Info:
android_sdk_repository(
name = "androidsdk",
path = "/usr/local/android/sdk",
api_level = 22,
build_tools_version="22.0.1",
)
android_ndk_repository(
name = "androidndk",
path = "/usr/local/android/ndk",
api_level = 22,
)
Bazel version (output of
bazel info release
):release 0.4.0
Thank you, any suggestion would be appreciated.
The text was updated successfully, but these errors were encountered: