-
Notifications
You must be signed in to change notification settings - Fork 257
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
[r12] Compiling any static executable leads to "error: undefined reference to 'atexit'" #132
Comments
It seems like
|
I think the breaking change was https://android-review.googlesource.com/#/c/219746/ Found some more skeletons in the closet. Looks like for some inexplicable reason |
These three changes ought to fix this: https://android-review.googlesource.com/#/q/topic:fix-static-exe Awaiting review, but unless further testing finds any issues with it this should be good to go for r13. @chenxiaolong: It's not quite all static executables that are broken. If you can target something lower than android-21 then it will build fine. Is that workaround sufficient for you? |
@DanAlbert Thanks for the fixes! I won't be able to compile and test until after I return from my business trip on Wednesday though. Unfortunately, I can't use anything lower than android-21 because I need the xattr functions (fsetxattr, fgetxattr, etc.). |
Changes are submitted. |
The only difference between crtbegin_static.c and crtbegin_dynamic.c is the inclusion of the atexit implementation. Until android-21, atexit was included in libc.a. After android-21, it's expected to come from crtbegin. In true NDK fashion, this isn't true across all architectures. x86 and mips always had this coming from crtbegin. Copy the android-9 ARM CRT files to android-21 and merge the crtbegin implementations. We should probably take a closer look at everything going on here at some point to make sure we don't need anything new from the bionic sources. Test: Improved tests/device/static-executable in the NDK, built ARM NDK, tested with and without `--platform android-21`. Bug: android/ndk#132 Change-Id: Ibc73984db25359590384391583bf24f738c8dd30
…es (see: android/ndk#132)" This reverts commit 2e3dc6b.
The static-executable test couldn't have caught android/ndk#132 because it's already marked broken for a different issue (duplicate symbols caused by L's libc.a including new/delete and friends colliding with libsupc++ for exception support). To make our test suite marginally less useless, split this into two tests. static-executable will be the bare minimum static executable test, and static-executable-exceptions will make sure exception support works (or, for now, doesn't). Test: Applied with other patches in topic (one of which removes the broken annotation for static-executable), static-executable passes for ARM android-21 and static-executable-exceptions remains a known failure. Bug: http://b/24468267 Bug: android/ndk#132 Change-Id: Ib83c8f01974db5139ab4069996a6bf2187e51a94
Before this, if an older platform level had separate source files for crtbegin_dynamic.o and crtbegin_static.o and a newer platform level had a shared source file, the shared source would not be used for the static version because the destination directory would have been pre-populated by the old version. Test: Together with the other CLs in the topic, built the ARM NDK and ran tests/device/static-executable with and without `--platform android-21`. Bug: android/ndk#132 Change-Id: I8d656076a64361935c427d6cbb7f7f418db8af21
I have this problem with platform 24 in r14b compiling ffmpeg libs into static one |
Test repo available here: https://github.com/chenxiaolong/ndk_atexit_test
Starting with the r12 release, it's no longer possible to compile static executables (at least with clang). The repo above contains a C program that does nothing except
return EXIT_SUCCESS
and it fails with the an undefined reference to atexit error.This happens with platforms 24, 23, 22, and 21.
r11c
did not have this issue.The text was updated successfully, but these errors were encountered: