-
Notifications
You must be signed in to change notification settings - Fork 226
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
Update Android NDK to 25 #5436
Comments
And when I try this time I see the same error. AFAICT, we're running into issues because the newer NDK removed libgcc. It was replaced it with libunwind -- I guess libgcc was only needed for unwind support. Many projects have ran into this issue, here's some examples for context: rust-lang, android-ndk, rust-android-gradle. Maybe I've tried several things with no success:
I also hacked linker-wrapper.py to print out what it was doing and verified that the end result had |
The best way I could find to test this was to:
|
I'm pretty sure this happens on I think this is why we have associated this issue with emulators, AFAIK x86-64 devices are rare in the wild. |
Part of the issue may be our old friend sqlcipher. I notice that library has an undefined |
And I think the other end of the issue is NSS:
This leads to several questions:
|
Can you get a complete build output (including when nspr/nss are built) from when you add |
(FWIW, I'm fairly convinced this is Rust's fault. Also, unfortunately, what I asked for is probably not going to be helpful, but also adding |
Sorry, I got pulled away for another few issues, but I'll run some builds with those flags today. Since moz-central landed the NDK23 update, I took a look at the
My hunch here is that libxul is statically linked to libgcc, which is why that symbol is defined. I see several reference to it that when I grep through the source. |
Here's the build output that I got by:
|
This may actually be an SQLite problem, rather than the SQLCipher fork specifically. We see this same undefined symbol when compiling a project using the |
No, it's statically linked to libclang_rt.builtins, which contains the symbol. clang does that automatically. The problem is that rust explicitly tells it not to do that with At least that's what I'd expect the problem to be, but
these logs don't contains libmegazord. |
Rust may be doing something wrong, but ISTM that there's definitely something wrong with NSS/sqlcipher/sqlite, or at least the way we build them. Those are built separately, without any help from Rust/Cargo, and they produce static libraries with an undefined I'm not sure how to get a log from the libmegazord build. We're using the |
What's odd is that I see many lines in the
However, the end result still has undefined symbols. So it seems like it's trying to link to |
The new NDK doesn't link to `libgcc`, 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 hack works around this by taking object files from the built libraries and `libclang_rt.builtins-x86_64-android.a`, and combining them together to get the final static library.
Those come from linking the .so files. The .a archives (static libs) don't contain the C runtime, and that's how it's supposed to be. The C runtime is only linked once, in dynamic libs/executables. Adding it to multiple .a that may all be linked together could be a source of build failures (although in practice, probably not).
A better option would be to add libclang_rt.builtins to the link-args for rust. |
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.
Sounds good. I updated this PR to take that approach, what you you think of this commit?
This is surprising to me because the static libs didn't used to have the undefined symbol with NDK21 and with NDK25 only the x86-64 lib has the undefined symbol. I'm asking because I want to know how to view the changes:
|
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.
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.
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.
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.
That seems fine.
The undefined symbols are generated by clang, because it's using those builtins for some float operations, now. It assumes the corresponding runtime is going to be linked at the end, which doesn't happen because of -nodefaultlibs, which rust adds. I'll file a bug against the rust compiler with a reproducer without the NDK. |
turns out, the rust compile saves itself on Linux by linking libgcc_s, so it's only really a problem with the NDK. |
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.
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.
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.
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.
This got merged in #5442 |
…ml [WPB-8945] On Android x86-64 we need to link the runtime lib statically because the compiler fails to do so due to -nodefaultlibs being given by default. This is not a problem on other Android platforms, though. More details at mozilla/application-services#5436
…ml [WPB-8945] On Android x86-64 we need to link the runtime lib statically because the compiler fails to do so due to -nodefaultlibs being given by default. This is not a problem on other Android platforms, though. More details at mozilla/application-services#5436
…ml [WPB-8945] On Android x86-64 we need to link the runtime lib statically because the compiler fails to do so due to -nodefaultlibs being given by default. This is not a problem on other Android platforms, though. More details at mozilla/application-services#5436
This is required to update Rust to 1.68 (#5435). The last time we tried to do this, we had linker errors (#5165).
┆Issue is synchronized with this Jira Task
┆Sprint End Date: 2023-03-24
The text was updated successfully, but these errors were encountered: