-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
getaddrinfo() thread failed on HPUX #2697
Comments
First, I note that the last curl release is provided as binary builds for HPUX by others so clearly it builds and works for some: https://curl.haxx.se/download.html#HPUX To me this sounds like something in your run-time environment makes it not find and use the pthread library and since configure both deemed it present and made use of it, this problem will prevent curl from working correctly. |
But I use the same commands to build it on RHEL, AIX and Solaris, curl can work well. Just curious why it just can not work on HPUX, seems the building for curl on HPUX needs a different configuration option (e.g. ./configure LIBS="-lpthread"), if so, i think at least curl needs give a doc for it. |
configure already checks for your pthreads library and if it fails to find it, it won't enable the threaded resolver in the first place. This makes me believe configure found it for you and made use of it correctly (configure's output and even the |
yes. configure check pthread and find it. But library pthread is not linked into curl on HPUX. Do you try to build the latest version of curl on HPUX? If you did, is library pthread included into the library dependencies of curl? |
Can you please show how this happens by pasting/including the relevant bits from the output or
No I don't. I'm still willing to help you nail down this problem and if necessary adjust things to make them work better. To do that, I must first understand what fails with the existing configure logic. |
I run "configure; make; make install" to build curl, no error occurs except for the following warning during make: then i check the lib dependencies of curl, pthread is not there. then i gdb debug curl, and found pthread_create always fail, and return errno 251 (function is not available). Note: Redhat, Solaris and AIX does not have this issue, and pthread is included into the lib dependencies of the curl on those platforms. just curious, i run the same command, why lib pthread is no t included into the lib dependencies of curl on HPUX. |
So I ask again: Can you please show how this happens by pasting/including the relevant bits from the configure output or config.log file? |
Please check config.log. Thanks. BTW, want to confirm with you for the following snippet of configure if test "$USE_THREADS_POSIX" != "1" <====== Should it be "$USE_THREADS_POSIX" = 1? |
No. That check is there to see if it isn't enabled yet and if so, do some additional checks. This code But what's curious about your config.log is that when configure checks if it can find and use |
I'm not sure. But I suspect the checking for pthread_create. line 60037 just tell the conftest is built successfully, but it does not tell if pthread_create is available or not. I have checked this issue for two days, and i'm not familiar with the building. If you have a HPUX, i think it should be able to be reproduced easily. |
That's not how linking generally works. The linker should check that the functions are available! This is clearly the reason why the pthread check fails on this system... I don't have an HPUX system and I never had. I logged into one though, once. Like 17 years ago or so... |
Google a lot. Found the reason pthread_create is failing with error 251 is the libc library provides stubs for the pthread functions on HPUX. So no link error does not mean you don't need to link pthread library on HPUX. Do you think you (configure.ac) should deal with this exception on HPUX? If so, can you provide me a patch for this issue? |
Can you try this patch and see if this works for you? It's a bit "crude" as it checks fox hpux specifically, but I really can't figure out a really nice way to do this. You need to apply the patch and run --- a/configure.ac
+++ b/configure.ac
@@ -3779,10 +3779,20 @@ if test "$want_pthreads" != "no"; then
save_CFLAGS="$CFLAGS"
dnl first check for function without lib
AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
+ dnl on HPUX, life is more complicated...
+ case $host in
+ *-hp-hpux*)
+ dnl it doesn't actually work without -lpthread
+ USE_THREADS_POSIX=""
+ ;;
+ *)
+ ;;
+ esac
+
dnl if it wasn't found without lib, search for it in pthread lib
if test "$USE_THREADS_POSIX" != "1"
then
CFLAGS="$CFLAGS -pthread"
AC_CHECK_LIB(pthread, pthread_create,
|
It's really a bit "crude". how about using AC_TRY_RUN? |
AC_TRY_RUN must be avoided as far as possible since it breaks cross-compilation. Since I rather have this "crudeness" limited to HPUX-only such a AC_TRY_RUN could be restricted to HPUX but then it seems like maybe not necessary? Do you think there's a risk different HPUX systems work differently in regards to the pthreads library? |
I'm not sure. I would like to have a elegant way to fix it, but i'm not familiar with autoconf. So ask your help here. |
And I have no HPUX system to test on so working on an "elegant fix" is not up to me. I can't think of a proper way to fix this detection while at the same time avoiding AC_TRY_RUN, but I don't want to "hurt" all other users because of this HPUX weirdness. An alternative would be to check if cross-compilation is being done, and only do the extra AC_TRY_RUN check if not. |
So @Eason-Yu, does the "crude" approach work at all? If so, it might be a better idea to land that than doing nothing? |
I might jump into this next month. I have been using HP-UX for the last 10 years, but haven't compiled curl on HP-UX for quite some time. |
@bagder Sorry for the delay. It works. Thanks a lot. |
When trying to detect pthreads use on HPUX the checks will succeed without the correct -l option but then end up failing at run-time. Reported-by: Eason-Yu on github Fixes #2697
I build curl-7.60.0 on HPUX by running "configure && make && sudo make install", then run the following command:
bash-3.1# /usr/local/bin/curl -x dcmfa02-w2k16d.mfa.cdc:8080 --connect-timeout 5 URL -v 2>&1
getaddrinfo() thread failed to start
Couldn't resolve proxy 'dcmfa02-w2k16d.mfa.cdc'
Closing connection 0
curl: (5) getaddrinfo() thread failed to start`
get a error "getaddrinfo() thread failed to start", then check the lib dependency of curl, pthread lib is not there.
Btw, using LD_PRELOAD specify with pthread lib, then it works well. details as follows:
bash-3.1# LD_PRELOAD=/usr/lib/libpthread.1 /usr/local/bin/curl -x dcmfa02-w2k16d.mfa.cdc:8080 --connect-timeout 5 URL -v 2>&1
< HTTP/1.1 200 Connection established
<
The text was updated successfully, but these errors were encountered: