-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
pthread_atfork for android API < 21 #3901
Comments
Please merge this into your other Android 21 issue.
|
Rich Salz wrote:
Please merge this into your other Android 21 issue.
Actually for [12-21) function is not declared only.
Roumen
|
Same problem here with openssl-1.1.1-pre6 .... is it safe to use "no-threads" if we do not use any API of https://www.openssl.org/docs/man1.0.2/crypto/threads.html or is it still a problem if we use multiple threads in our application?
|
Using Android NDK r16b with unified headers does not have that problem whereby r10e shows the error. |
What is to be done with this issue? This has the 1.1.1 milestone against it. |
Main question is how to correct. Another question is about minimum supported Android version. More up to date information . Android API 23 (Marshmallow v6.0) adds "__register_atfork" but still keep "pthread_atfork" visible for backward compatibility. |
This looks to me like an NDK bug. I've been testing various versions of the NDK and see different behaviour between them. The latest versions of the NDK do not have the problem at all - you can compile without warning or errors and target the oldest supported API level (14) without issue. When I tested NDK 10e (the oldest version I could get my hands on), I found that at API level 12, I got the warning about the implicit declaration and it failed to link because of the missing definition. I also tested NDK 14b. With this version API level 12 and 14 saw the implicit declaration warning, but linking succeeded. However at API level 9 (there is no 10 or 11 in the NDK...not sure why) linking failed. NDK 15c behaves in the same way as 14b. So, it seems to me that this isn't really an OpenSSL issue at all. The answer is to upgrade your NDK version. That does imply that we cannot support API versions lower than 12 because the bug is not fixed in API levels that old. If you want warning free OpenSSL builds then you have to use one of the latest NDK versions (which further restricts you to API version 14 or above). However since Google themselves do not support API versions this old, I'm not sure why we should have to. |
Problem seems to be in gcc compiler bugs in latest NDKs. Qt recommends to be compiled with NDK 10e (GCC 4.9). android/ndk#67 |
What about to resolve issue at run-time? Approach is not new to OpenSSL. It is used in CAPI engine - dialog functionality if I remember well. For android to use: Any thoughts? |
@misery wrote:
Any reason you can't use a different NDK version to compile OpenSSL vs Qt? @petrovr wrote:
Why would we do that? It seems that is adding significant extra complexity into OpenSSL for something which is an NDK problem to solve (and has been in the latest NDK releases). |
We tried NDK r15 sometime ago and got crashes for arm64 builds. I think it will be possible to switch to clang of newest NDK someday. But this needs a little bit more testing in next release cycle. But since clang is supported by Qt for Android we need NDK r10e (gcc). |
I am closing this on the basis that I do not think this is an issue for OpenSSL to solve. The problem exists in NDK, and suitable workarounds exist. |
atexit/atfork ndk: support info |
I don't see anything in the linked issue referencing atfork? |
It is a shame Android removed this. What do you think openssl should do? A pull request would be helpful. |
Functions pthread_atfork is not defined if Android API < 12(a) and is not declared if API < 21(b).
If first case (a) build(link) fail.
What about to exclude code that use pthread_atfork "#if ANDROID_API < 21" ?
The text was updated successfully, but these errors were encountered: