<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/packages/Python/lldbsuite/test/make/Android.rules, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>lldb: get lldb API tests working with newer Android NDKs</title>
<updated>2024-09-25T03:00:34+00:00</updated>
<author>
<name>Andrew Rogers</name>
<email>andrurogerz@gmail.com</email>
</author>
<published>2024-09-25T03:00:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=18b9d49ce3370c012fdd04ec87d854d53293f6a6'/>
<id>18b9d49ce3370c012fdd04ec87d854d53293f6a6</id>
<content type='text'>
## 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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## 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.</pre>
</div>
</content>
</entry>
<entry>
<title>Android.rules: remove mips* rules</title>
<updated>2023-03-23T22:58:43+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2023-03-23T22:58:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ccc2f362db352df8991f493d8a05bdf99eaeea4b'/>
<id>ccc2f362db352df8991f493d8a05bdf99eaeea4b</id>
<content type='text'>
They have been obsoleted for a long time and D146565 recently removed
Clang support.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They have been obsoleted for a long time and D146565 recently removed
Clang support.
</pre>
</div>
</content>
</entry>
<entry>
<title>[test] Migrate -gcc-toolchain with space separator to --gcc-toolchain=</title>
<updated>2021-08-20T22:24:58+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2021-08-20T22:24:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=40aab0412fe7a14781e133627c2bb0a22761eac8'/>
<id>40aab0412fe7a14781e133627c2bb0a22761eac8</id>
<content type='text'>
Space separated driver options are uncommon but Clang traditionally
did not do a good job. --gcc-toolchain= is the preferred form.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Space separated driver options are uncommon but Clang traditionally
did not do a good job. --gcc-toolchain= is the preferred form.
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][test_suite] skip tests of `libstdcpp` on Android and clean up</title>
<updated>2019-07-23T00:28:26+00:00</updated>
<author>
<name>Alex Langford</name>
<email>apl@fb.com</email>
</author>
<published>2019-07-23T00:28:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e5001fe5c1ac00ced55168758ddccaa434175037'/>
<id>e5001fe5c1ac00ced55168758ddccaa434175037</id>
<content type='text'>
Summary: Delete the android target from `libstdcpp` test category, since android no longer support libstdcxx

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: srhines, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64771

llvm-svn: 366770
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary: Delete the android target from `libstdcpp` test category, since android no longer support libstdcxx

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: srhines, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64771

llvm-svn: 366770
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb_test_suite] Fix lldb test suite targeting remote Android</title>
<updated>2019-07-09T21:35:58+00:00</updated>
<author>
<name>Alex Langford</name>
<email>apl@fb.com</email>
</author>
<published>2019-07-09T21:35:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=695f7821e2d90210ac93533393a0a028a4a08600'/>
<id>695f7821e2d90210ac93533393a0a028a4a08600</id>
<content type='text'>
Summary:
Fixed `Android.rules` for running test suite on remote android
- the build configuration is not compatible with ndk structure, change it to link to static libc++
- generally clang should be able to use libc++ and will link against the right library, but some libc++ installations require the user manually link libc++abi.
- add flag `-lc++abi` to fix the test binary build failure

Added `skipIfTargetAndroid` `skipUnlessTargetAndroid` for better test support
- the `skipIfPlatform` method will ask `lldbplatformutil.getPlatform()` for platform info which is actually the os type, and //Android// is not os type but environment
- create this function to handle the android target condition

**To Run Test on Remote Android**
1 start lldb-server on your devices
2 run lldb-dotest with following configuration:
`./lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name remote-android --platform-url connect://localhost:12345 --platform-working-dir /data/local/tmp/ --compiler your/ndk/clang`

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: labath, javed.absar, kristof.beyls, srhines, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64118

llvm-svn: 365561
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
Fixed `Android.rules` for running test suite on remote android
- the build configuration is not compatible with ndk structure, change it to link to static libc++
- generally clang should be able to use libc++ and will link against the right library, but some libc++ installations require the user manually link libc++abi.
- add flag `-lc++abi` to fix the test binary build failure

Added `skipIfTargetAndroid` `skipUnlessTargetAndroid` for better test support
- the `skipIfPlatform` method will ask `lldbplatformutil.getPlatform()` for platform info which is actually the os type, and //Android// is not os type but environment
- create this function to handle the android target condition

**To Run Test on Remote Android**
1 start lldb-server on your devices
2 run lldb-dotest with following configuration:
`./lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name remote-android --platform-url connect://localhost:12345 --platform-working-dir /data/local/tmp/ --compiler your/ndk/clang`

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: labath, javed.absar, kristof.beyls, srhines, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64118

llvm-svn: 365561
</pre>
</div>
</content>
</entry>
<entry>
<title>Android.rules: Use libc++ by default</title>
<updated>2018-06-22T13:13:29+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>labath@google.com</email>
</author>
<published>2018-06-22T13:13:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=733ad45b9fcdd6a5c6a6df5d33d65fb6d78c7b31'/>
<id>733ad45b9fcdd6a5c6a6df5d33d65fb6d78c7b31</id>
<content type='text'>
libstdc++ will soon be dropped from the android NDK. This patch makes
sure we are prepared for that by using libc++ in tests by default (i.e.,
except for libstdc++ data formatter tests).

Only a couple of small tweaks were needed to make this work:
- Add the libc++ include paths to CXXFLAGS only. This was necessary to
  make the tests compile with -fmodules. The modules tests have been
  disabled, but this way, they will be ready for them if they are
  enabled.
- in one test I had to add an explicit std::string copy to make sure the
  copy constructor is there for the expression evaluator to find it.

llvm-svn: 335344
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libstdc++ will soon be dropped from the android NDK. This patch makes
sure we are prepared for that by using libc++ in tests by default (i.e.,
except for libstdc++ data formatter tests).

Only a couple of small tweaks were needed to make this work:
- Add the libc++ include paths to CXXFLAGS only. This was necessary to
  make the tests compile with -fmodules. The modules tests have been
  disabled, but this way, they will be ready for them if they are
  enabled.
- in one test I had to add an explicit std::string copy to make sure the
  copy constructor is there for the expression evaluator to find it.

llvm-svn: 335344
</pre>
</div>
</content>
</entry>
<entry>
<title>Android.rules: build with "unified android headers"</title>
<updated>2017-10-31T10:33:03+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>labath@google.com</email>
</author>
<published>2017-10-31T10:33:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=73447900055804edac1d4f00fe47678545efd12d'/>
<id>73447900055804edac1d4f00fe47678545efd12d</id>
<content type='text'>
Unified headers will be the only way to build applications in NDK r16,
and it also works with NDK r15.

This also bumps the minimum supported android version to 16.

llvm-svn: 316985
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unified headers will be the only way to build applications in NDK r16,
and it also works with NDK r15.

This also bumps the minimum supported android version to 16.

llvm-svn: 316985
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Android.rules: build x86 tests with -mstackrealign"</title>
<updated>2017-07-06T11:43:20+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>labath@google.com</email>
</author>
<published>2017-07-06T11:43:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0fa83961650455c1ac714e09ebdb8dd133345c03'/>
<id>0fa83961650455c1ac714e09ebdb8dd133345c03</id>
<content type='text'>
Starting with android ndk r15, clang much more tests are affected by the
-mstackrealign bugl (now nearly all functions are affected, and not just
the ones requiring 16-byte alignment). Due to their numbers, Xfailing
all of them is not a viable option, so we will just have to declare this
configuration unsupported, and wait until ndk ships a clang version that
has this bug fixed.

llvm-svn: 307252
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Starting with android ndk r15, clang much more tests are affected by the
-mstackrealign bugl (now nearly all functions are affected, and not just
the ones requiring 16-byte alignment). Due to their numbers, Xfailing
all of them is not a viable option, so we will just have to declare this
configuration unsupported, and wait until ndk ships a clang version that
has this bug fixed.

llvm-svn: 307252
</pre>
</div>
</content>
</entry>
<entry>
<title>Android.rules: build x86 tests with -mstackrealign</title>
<updated>2017-06-29T14:32:23+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>labath@google.com</email>
</author>
<published>2017-06-29T14:32:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=217a763bb274771d7fe6c4444a7e3f030169e6f2'/>
<id>217a763bb274771d7fe6c4444a7e3f030169e6f2</id>
<content type='text'>
All android builds systems have switched to -mstackrealign for building
x86 binaries, so follow their cue with our mini build system.

This presently breaks just one test (TestReturnValue), and this is due
to a compiler bug, which has already been fixed in clang, but it hasn't
made it yet into the official NDK compiler. While I'm touching that
test, I also remove an android-specific XFAIL, which is not relevant
anymore.

llvm-svn: 306683
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All android builds systems have switched to -mstackrealign for building
x86 binaries, so follow their cue with our mini build system.

This presently breaks just one test (TestReturnValue), and this is due
to a compiler bug, which has already been fixed in clang, but it hasn't
made it yet into the official NDK compiler. While I'm touching that
test, I also remove an android-specific XFAIL, which is not relevant
anymore.

llvm-svn: 306683
</pre>
</div>
</content>
</entry>
<entry>
<title>Android.rules: set "ar" path correctly</title>
<updated>2017-05-02T13:14:45+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>labath@google.com</email>
</author>
<published>2017-05-02T13:14:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=59bc6d1ce0c0ff93e91dede772b6693681632944'/>
<id>59bc6d1ce0c0ff93e91dede772b6693681632944</id>
<content type='text'>
llvm-svn: 301918
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 301918
</pre>
</div>
</content>
</entry>
</feed>
