-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
lldb API tests fail to compile inferiors with newer Android NDK (r22b or later) #106270
Comments
@llvm/issue-subscribers-lldb Author: Andrew Rogers (andrurogerz)
Android introduced a unified tools layout in NDK r19 (2019) and removed support for the old layout in r22 (2021). Running lldb tests with NDK r22 or newer fails when compiling the test inferiors because `Android.rules` references an outdated sysroot path (and other paths) that no longer exists. More details on NDK unified tools changes are [here](https://github.com/android/ndk/issues/780).
This issue can be fixed by teaching
Since the change will only impact the ability to run the lldb API tests against Android remote targets, I recommend going with option 2 because it leaves the codebase cleaner and I cannot come up with any reason to run the tests against a 5+ year old NDK. Repro Steps
Expected ResultsThe test passes just like when run against NDK r19:
Actual ResultsThe test fails when compiling the inferior:
|
I am locally testing changes to |
## Purpose Running the LLDB API tests against a remote Android target with NDK version r22 or later fails to compile the test inferiors. NDK r21 from 2021 is the most recent NDK that still works with the LLDB API tests. This PR updates the Android make rules to support newer Android NDK versions (r19 and later). ## Overview * Updates and simplifies `Android.rules` to match the newer Android NDK unified toolchain layout introduced in NDK r19 * Sets `OBJCOPY` and `ARCHIVER` env vars, required by a few test cases, to their `llvm-` versions in the unified toolchain * Drops support for pre-2019 Android NDK versions to keep the rules simple * Provides an error message if the tests are run using an incompatible NDK layout ## Problem Details Android introduced a unified tools layout in NDK r19 (2019) and removed the old layout in r22 (2021). Releases r19, r20, and r21 support both the old and new layout side-by-side. More details are in #106270. ## Validation Ran a sub-set of the LLDB API tests against remote Android targets for the four primary architectures i386, x86_64, arm, and aarch64. No validation was done against riscv targets. For each case, ran the copy of `lldb-server` from the Android NDK on the device with the latest LLDB test cases in llvm-project Ran tests with both r19 (the oldest supported) and r26 (more recent, unified layout only) NDK versions. Example test command for aarch64: ``` ./build/bin/lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name remote-android --platform-url connect://localhost:5432 --platform-working-dir /data/local/tmp --compiler=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang lldb/test/API/android/ ``` **NOTE: there are a lot of test failures when running the full suite (especially against 32-bit ARM target). These failures occur independent of this change.** Verified the expected error message appears when attempting to run using NDK r18 ``` Build Command Output: make: Entering directory '/home/andrew/src/llvm/llvm-project/build/lldb-test-build.noindex/android/platform/TestDefaultCacheLineSize.test_cache_line_size' /home/andrew/src/llvm/llvm-project/lldb/packages/Python/lldbsuite/test/make/Android.rules:16: *** "No unified toolchain sysroot found in /home/andrew/Android/Sdk/ndk/18.1.5063045/toolchains/llvm/prebuilt/linux-x86_64/bin/../../../../... NDK must be r19 or later.". Stop. make: Leaving directory '/home/andrew/src/llvm/llvm-project/build/lldb-test-build.noindex/android/platform/TestDefaultCacheLineSize.test_cache_line_size' ``` ## Impact **This change explicitly removes support for the pre-2019 NDK structure.** Only NDK r19 (from 2019) and later can be used when running the LLDB API tests. If the maintainers object, we can easily support both the old and new NDK toolchain layouts side-by-side at the cost of readability/maintainability. Since this change only impacts tests, I don't see much value in supporting NDKs that are over 5 years old. ## Guidance to Reviewers * I am not an expert on `clang` arguments so if anything looks off let me know. * While I personally thing supporting 5+ year old NDKs for testing seems unnecessary, please chime-in if you are concerned with dropping that support. I can easily revise to support both old and new layouts side-by-side. * If there are any specific tests you'd like me to run I will do my best to accommodate. It doesn't look like there's much (any?) Android LLDB CI coverage.
Android introduced a unified tools layout in NDK r19 (2019) and removed support for the old layout in r22 (2021). Running lldb tests with NDK r22 or newer fails when compiling the test inferiors because
Android.rules
references an outdated sysroot path (and other paths) that no longer exists. More details on NDK unified tools changes are here.This issue can be fixed by teaching
Android.rules
about the new NDK structure. There are two ways to proceed:Android.rules
complex and difficult to maintain.Android.rules
from what it is currently and will be more maintainable.Since the change will only impact the ability to run the lldb API tests against Android remote targets, I recommend going with option 2 because it leaves the codebase cleaner and I cannot come up with any reason to run the tests against a 5+ year old NDK.
Repro Steps
lldb-server
from the NDK to the devicelldb-server
in platform mode on the Android deviceExpected Results
The test passes just like when run against NDK r19:
Actual Results
The test fails when compiling the inferior:
The text was updated successfully, but these errors were encountered: