Skip to content

Fix building with Android NDK 18+ using Clang/LLVM #1659

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

Open
BugsBeGone opened this issue Mar 12, 2025 · 0 comments
Open

Fix building with Android NDK 18+ using Clang/LLVM #1659

BugsBeGone opened this issue Mar 12, 2025 · 0 comments

Comments

@BugsBeGone
Copy link
Contributor

More of a place for discussion than an urgent need to be resolved, I have specifically not made a PR yet as this is nowhere near comprehensively tested. It would be very helpful if anyone with libffi experience in other projects knows about any tricks moving from gcc to clang.

Anyway, here is a branch with my proposed changes: https://github.com/BugsBeGone/jna/commits/android-ndk-llvm/
Actual commit, which may be out of date if branch is rebased to sync with master: BugsBeGone@98a7eca

Some initial observations:

  • ARMv5 and MIPS (32 & 64) targets were removed in NDK r17. In theory the Play Store still supports versions of Android that could be running on those architectures, so it is a bit soon to drop them entirely if the old toolchains do still work. At the very least I would expect a major JNA version bump to indicate the removed targets.

  • Standalone toolchains are a mess for detecting the version. I cannot think of a way that does not involve the user manually setting either the NDK major version, or a USE_CLANG define to work out which compiler suite to use. I would be in favour of officially not supporting the use of standalone toolchains, as you need approximately 1GB of extra disk space per target, so even testing it is a pain.

  • More to the point, NDKs between r17 & r21 generally seem to be unstable, requiring unholy combinations of GCC/Binutils & Clang/LLVM to work at all. Since the existing build environment has never worked with anything after r15, because of the switch to unified headers, we probably do not need to worry too much so long as everyone is happy to jump from let's say r15 to r22.

I have mostly been testing with r27c, since that is the latest LTS release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant