-
Notifications
You must be signed in to change notification settings - Fork 230
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 NDK 25 [firefox-android: main] #5442
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04%
==========================================
Files 172 172
Lines 14378 14387 +9
==========================================
- Hits 6487 6486 -1
- Misses 7891 7901 +10
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here. |
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.
There's nothing here that worries me beyond the obvious grossness of the workaround.
The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle
plugin to do this symbol dance (or to remove -nodefaultlibs
or whatever the flag was) and generalize this slightly.
I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.
What a tremendous waste of time and effort :(
68edfed
to
6a0f8eb
Compare
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS and SQLCipher libraries since they depended on the symbols from libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for more details. The change works around this by manually linking to the libclang_rt.builtins-x86_64-android library in this case. Added a doc on how to upgrade the Android NDK which hopefully will help us in the future. Extracted some common code from the the `build-*-android.sh` scripts to make these directions simpler.
Adds a temporary workaround for [an issue] with the Rust compiler and Android when compiling for x86_64 devices. The Android NDK used to include `libgcc` for unwind support (which is required by Rust among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`. However, `libgcc` was ambiently providing other compiler builtins, one of which we require: `__extenddftf2` for software floating-point emulation. This is used by SQLite (via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`. Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because [it involves floating-point types that are not supported by Rust][unsupported]. For some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run the SDK on an x86_64 emulator. The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the builtins from the Clang runtime provided inside the NDK, to provide this symbol. [an issue]: rust-lang/rust#109717 [this Mozilla PR]:mozilla/application-services#5442 [unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25 Fixes rusqlite#1380
Adds a temporary workaround for [an issue] with the Rust compiler and Android when compiling for x86_64 devices. The Android NDK used to include `libgcc` for unwind support (which is required by Rust among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`. However, `libgcc` was ambiently providing other compiler builtins, one of which we require: `__extenddftf2` for software floating-point emulation. This is used by SQLite (via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`. Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because [it involves floating-point types that are not supported by Rust][unsupported]. For some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run the SDK on an x86_64 emulator. The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the builtins from the Clang runtime provided inside the NDK, to provide this symbol. [an issue]: rust-lang/rust#109717 [this Mozilla PR]:mozilla/application-services#5442 [unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions This fix was copied from: Electric-Coin-Company/zcash-android-wallet-sdk@1bf2f84 Fixes rusqlite#1380 Co-authored-by: Jack Grigg <jack@electriccoin.co>
This updates the code to use android NDK 25.
The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?
Pull Request checklist
[ci full]
to the PR title.Branch builds: add
[firefox-android: branch-name]
to the PR title.