-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[android] Update to NDK 23b #39921
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
[android] Update to NDK 23b #39921
Conversation
The latest Long Term Support NDK finally removed binutils, including the bfd/gold linkers and libgcc. This simplifies our Android support, including making lld the default linker for Android. Disable three reflection tests that now fail, likely related to issues with swift-reflection-dump and switching to lld.
Rebased and switched from |
@CodaFi, would you run the CI on this? |
@swift-ci please test |
const char *AR; | ||
// Configure the toolchain. | ||
const char *AR = | ||
context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar"; | ||
if (getTriple().isAndroid()) | ||
AR = "llvm-ar"; | ||
else | ||
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still my opinion that if we are going to keep adding isAndroid()
branches to the GenericUnix
toolchain, it would be better to add a Android
toolchain (like OpenBSD and Cygwin already have) and stop adding special branches for Android. Not something to hold the PR, but something you should think about if these special cases keep popping up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll look into spinning that out.
if 'ANDROID_DATA' in os.environ: | ||
_register("ranlib", "llvm-ranlib") | ||
_register("ar", "llvm-ar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, this is just things needed for your specific environment. LLVM can install symlinks with the unprefixed name if you ask. You can create this symlinks in your machine. The LLVM reimplementations are supposed to be command-line compatible with the GNU counterparts most of the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no, this checks if the build-script
is running natively on Android itself, which means it's almost certainly running in the Termux app. With the switch to NDK 23b, I've switched both the native clang and swift toolchains in Termux to use llvm-ar directly, as that's what the NDK 23b does without providing a symlink to ar
. This keeps everything consistent across the NDK and the Termux app.
Since it keeps everything consistent and only ever affects those few people building the Swift toolchain natively on Android, this shouldn't affect anybody else but makes native compilation on Android work out of the box.
Android AArch64 CI just passed, armv7 should pass in a couple minutes, glad to see the CI on the latest NDK. 🧨 |
The latest Long Term Support NDK finally removed binutils, including the bfd/gold linkers and libgcc. This simplifies our Android support, including making lld the default linker for Android. Disable three reflection tests that now fail, likely related to issues with
swift-reflection-dump
and switching to lld.@drodriguez, this tweaks the now-reverted #39045 to work with the just-released LTS NDK 23b and pass the Windows CI. I also removed the libatomic addition on armv7, because NDK 23 just uses libcompiler-rt instead. You can diff this against #39045 to see the few tweaks I made.