-
Notifications
You must be signed in to change notification settings - Fork 263
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
[BUG] with ndk r23 and newer, builtin symbols cannot be found when a program is linked with libtool #1614
Comments
I've added a minimal CMakeLists.txt as well to the repo. Compiling the program and library with it instead:
gives a working
|
Is there any good way to detect this issue without running the program on device? for arch in aarch64 arm i686 x86_64; do
if [ "$arch" != arm ]; then
CC=$arch-linux-android-clang
else
CC=$arch-linux-androideabi-clang
fi
symbols="$(readelf -Wa $($CC -print-libgcc-file-name) | grep "FUNC GLOBAL HIDDEN" | awk '{print $8}')"
libraries="$(find path/to/libs/for/$arch -name "*.so")"
for lib in $libraries; do
echo $lib;
for sym in $symbols; do
readelf -Wa $lib | grep "UND $sym"
done
done
done This seem to work for all arches except arm. On arm we get false positives (in the sense that the program, gettext in this case, works fine even though these looks like undefined symbols):
is this type of search the best way to detect the issue? |
it's a hack, but you could probably just hard-code the list from https://android.googlesource.com/platform/bionic/+/master/libc/arch-arm/bionic/__aeabi.c and ignore them? |
@enh-google yes, alright, thanks |
Building packages that use libtool for linking libraries has issues with ndk-r23 (android/ndk#1614). This check makes sure that the built libraries do not give an error like CANNOT LINK EXECUTABLE "tesseract": cannot locate symbol "__extenddftf2" referenced by "/data/data/com.termux/files/usr/lib/libtesseract.so"... once used on device. In android/ndk#1614 it seemed like arm gave false positives and needed special consideration, but when I tested it again today the same false positives do not occur in built libraries, so no "if arm then .." workaround has been added for now.
Building packages that use libtool for linking libraries has issues with ndk-r23 (android/ndk#1614). This check makes sure that the built libraries do not give an error like CANNOT LINK EXECUTABLE "tesseract": cannot locate symbol "__extenddftf2" referenced by "/data/data/com.termux/files/usr/lib/libtesseract.so"... once used on device. In android/ndk#1614 it seemed like arm gave false positives and needed special consideration, but when I tested it again today the same false positives do not occur in built libraries, so no "if arm then .." workaround has been added for now.
Building packages that use libtool for linking libraries has issues with ndk-r23 (android/ndk#1614). This check makes sure that the built libraries do not give an error like CANNOT LINK EXECUTABLE "tesseract": cannot locate symbol "__extenddftf2" referenced by "/data/data/com.termux/files/usr/lib/libtesseract.so"... once used on device. In android/ndk#1614 it seemed like arm gave false positives and needed special consideration, but when I tested it again today the same false positives do not occur in built libraries, so no "if arm then .." workaround has been added for now.
Building packages that use libtool for linking libraries has issues with ndk-r23 (android/ndk#1614). This check makes sure that the built libraries do not give an error like CANNOT LINK EXECUTABLE "tesseract": cannot locate symbol "__extenddftf2" referenced by "/data/data/com.termux/files/usr/lib/libtesseract.so"... once used on device. In android/ndk#1614 it seemed like arm gave false positives and needed special consideration, but when I tested it again today the same false positives do not occur in built libraries, so no "if arm then .." workaround has been added for now.
@Grimler91 have you had a chance to test this with r24 or r25 yet by any chance? We haven't had a chance to dig into this yet and we're getting r23c ready, so wondering where I should retriage to. |
@DanAlbert both r24 and r25-beta2 seem to be affected as well (at least for aarch64) |
Previous auto-update failed for arm with: ``` ERROR: lib/libhunspell-1.7.so contains undefined symbols: 35: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_idiv 123: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uidivmod ``` and 1.7.1 has since been absent from repo. Issue is reported in android-ndk repo here: android/ndk#1614
Previous auto-update failed for arm with: ``` ERROR: lib/libhunspell-1.7.so contains undefined symbols: 35: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_idiv 123: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uidivmod ``` and 1.7.1 has since been absent from repo. Issue is reported in android-ndk repo here: android/ndk#1614
Previous auto-update failed for arm with: ``` ERROR: lib/libhunspell-1.7.so contains undefined symbols: 35: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_idiv 123: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uidivmod ``` and 1.7.1 has since been absent from repo. Issue is reported in android-ndk repo here: android/ndk#1614
Our undefined symbol finder reports: 85: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __aarch64_ldadd8_acq_rel 104: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __aarch64_ldadd8_relax Issue was reported by /u/Economy-Artist593 on reddit. Ref: android/ndk#1614
Our undefined symbol finder reports: 85: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __aarch64_ldadd8_acq_rel 104: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __aarch64_ldadd8_relax Issue was reported by /u/Economy-Artist593 on reddit. Ref: android/ndk#1614
|
Oh, well that option generally shouldn't be used, and in the rare cases where it's necessary, it's up to whoever is passing that option to make sure they get the rest right. If that's the problem here I think we can close this. |
Yes, whatever system is forcing
|
Hi,
Description
Moving from ndk r21 to r23 we started having issues [1], [2], [3], [4], [5], with some programs failing to be run on device with errors like:
In both cases the issue seem to only happen if the code is compiled using a configure && make system, with a CMakeLists.txt it works fine. After some digging we suspect this happens due to libtool and how it handles the linker flags (see discussion).
One (rather ugly) workaround to solve the issue is to add libclang_rt.builtins-aarch64-android.a as a lib in LDFLAGS. Is there a better solution?
Steps to reproduce
The example below is for aarch64.
You should get something like:
The __extend* symbols are undefined in libtest.so when compiled like above:
but for ndk r21, where we linked against libgcc, we get
Environment Details
The text was updated successfully, but these errors were encountered: