-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[TEMP. FIX] undefined reference to `pthread_atfork' #3884
Comments
What platform? Pthread_atfork is a standard API in pthreads library.
|
Well, I tried on my server, which is Debian 9 from OVH, and on my desktop, OpenSUSE Tumbleweed. Both with the same result. I used gcc-7/g++-7, maybe because of this? |
Well, this error happens also with gcc/g++ 6. |
It’s the pthreads library.
|
Note: pthread_atfork can be in libc rather than libpthreads. |
Yes, good point.
Either way, is it reasonable for us to assume that pthread_atfork exists if posix threads is used on Linux? Or do we need another
Compile flag?
|
It looks to me like this is an order problem:
Shouldn't |
You should use "-pthread", not "-lpthread".
…-lpthread will probably also work if you move it to the end of the
libraries.
For some reason you're also using a static version of all the
libraries. I suggest you use shared versions instead if you can.
Your OS should already provide shared versions of those libraries.
|
I'm with @levitte the -lpthread should be later in the command line. After the .a files. That is more like:
|
So finally, It seems that the Nginx configuration file is quite odd. So the the temporary solution for now is a hack. After running the Thanks to all of you who supported me through this whole issue. |
Ok, cool. |
We're glad you got it working. You can still open an issue with nginx. OpenSSL's GH repo is just a downstream clone and we take issues :) This will come up for anyone who is building from master and the next release. Their config file was wrong and they just got lucky until now. |
this worked for me:
|
Hmm, there was another issue where someone complained that our |
Today i get the same problem when use
openssl : d2ef6e4 |
And i add ...
-Wl,-z,relro -Wl,-z,now -pie -ldl -lpthread -lcrypt -lpcre ../openssl-master/.openssl/lib/libssl.a ../openssl-master/.openssl/lib/libcrypto.a -ldl -lz \
-Wl,-E
../openssl-master/.openssl/lib/libcrypto.a(threads_pthread.o):In function ‘fork_once_func’:
threads_pthread.c:(.text+0x16):undefined reference to 'pthread_atfork' |
Yeah, it's a solution, but kind of a hack. If we're at fault, I will gladly resolve it, but maybe not this week (out travelling) |
For those who want a scripted temporary solution: gawk -i inplace \
'/pthread/ { sub(/-lpthread /, ""); sub(/-lpthread /, ""); sub(/\\/, "-lpthread \\"); print } ! /pthread/ { print }' \
"objs/Makefile" |
@levitte - do we need to do something here? |
Yes, we do, we need to make sure that |
Even -pthread gets treated that way. The reason to do this is so it ends up in 'Libs.private' in libcrypto.pc. Fixes openssl#3884
Even -pthread gets treated that way. The reason to do this is so it ends up in 'Libs.private' in libcrypto.pc. Fixes openssl#3884
nginx 1.13.11 fix |
Hello Im having this same issue under
with:
none of the work around did work for me, because I can't downgrade to that version with apt |
You should look into the order in which the linking command line gets the different libraries, which means you need to tell your make to be a bit more verbose |
In my case, building of openssl library with flag no-threads, was the solution:
|
you should use "--with-ld-opt=-pthread" |
Hi. I'm trying to build Nginx with this script, but I get this error.
I was able to build two weeks ago, so this issue must be new.
[EDIT] See the temporary fix.
The text was updated successfully, but these errors were encountered: