curl / Mailing Lists / curl-library / Single Mail

curl-library

RE: Problem building curl 7.64.0 on AIX 7.2 using xlc 13.1.0

From: Michael Schultz via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 14 Mar 2019 19:44:52 +0000

-----Original Message-----
From: Michael Schultz
Sent: Thursday, March 14, 2019 10:30 AM
To: libcurl development <curl-library_at_cool.haxx.se>
Subject: RE: Problem building curl 7.64.0 on AIX 7.2 using xlc 13.1.0

From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Thursday, March 14, 2019 5:28 AM
To: Michael Schultz via curl-library <curl-library_at_cool.haxx.se>
Cc: Michael Schultz <Michael.Schultz_at_microfocus.com>
Subject: RE: Problem building curl 7.64.0 on AIX 7.2 using xlc 13.1.0

On Wed, 13 Mar 2019, Michael Schultz via curl-library wrote:

> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
> ld: 0711-317 ERROR: Undefined symbol: .pthread_join
> ld: 0711-317 ERROR: Undefined symbol: .pthread_create
> ld: 0711-317 ERROR: Undefined symbol: .pthread_detach

...

> So, this is definitely a problem with the pthread library.
>
> I'll dig into it some more.

You could try something like this to specifically add some libs:

LIBS="-ldl -lpthread" ./configure ...

configure really can't always detect every dependency when you build with static libs so it might need some handholding.

> And I'm wondering if the -pthread shouldn't be -qthreaded on AIX. The
> 7.64.0 configure contains:
>
> CFLAGS="$CFLAGS -pthread"
> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for
> pthread_create in -lpthread" >&5
>
> It seems uncool to alter CFLAGS like that. The 7.49.1 configure
> doesn't just unilaterally append -pthread to the CFLAGS.

Believe it or not, but we actually work really hard on improving curl over time so things change and we apparently deemed that change to be a sensible one.

If you look a little further down (and I suggest you read the configure.ac file and not configure) you'll see that it also *restores* CFLAGS again to the former value if doing that -pthread attempt wasn't successful.

Or you saying that restore didn't work or that something else there is wrong?
I'm sure we can improve configure further. It will never be perfect and it certainly has room for getting better.

> I haven't diff'd them, but the two configures appear to be different
> in this area, so someone has performed some work here.

The configure script has changed quite a lot in that time period of almost three years. The configure.ac file alone was changed 98 times!

Unfortunately we don't have any AIX builds in our CI or autobuilds, so regressions like this are not totally surprising. :-/

-- 
  / daniel.haxx.se
===
Daniel,
<< If you look a little further down (and I suggest you read the configure.ac file and not configure) you'll see that it also *restores* CFLAGS again to the former value if doing that -pthread attempt wasn't successful.>>
Well, I think that the issue is that the -pthread attempt was successful, but only because the build of the test program included -lpthread on its command line. Unfortunately, that wasn't made part of the libraries later.
I believe that part of the issue is that the -pthread makes no sense to xlc, at least to the version that I have.  I think that it is the source to the warning "/opt/IBM/xlc/13.1.0/bin/.orig/xlc: 1501-210 (W) command option t contains an incorrect subargument". I think that it is interesting that this warning appears twice in the link of curl, and there are two -pthread on that command line, one near the beginning and one at the very end.
libtool: link: xlc -O2 -pthread -o curl curl-slist_wc.o curl-tool_binmode.o curl-tool_bname.o curl-tool_cb_dbg.o curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o curl-tool_convert.o curl-tool_dirhie.o curl-tool_doswin.o curl-tool_easysrc.o curl-tool_filetime.o curl-tool_formparse.o curl-tool_getparam.o curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o curl-tool_homedir.o curl-tool_hugehelp.o curl-tool_libinfo.o curl-tool_main.o curl-tool_metalink.o curl-tool_msgs.o curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o curl-tool_paramhlp.o curl-tool_parsecfg.o curl-tool_strdup.o curl-tool_setopt.o curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o curl-tool_vms.o curl-tool_writeout.o curl-tool_xattr.o ../lib/curl-strtoofft.o ../lib/curl-nonblock.o ../lib/curl-warnless.o ../lib/curl-curl_ctype.o  -L/usr/local/openssl-1.1.1a/lib ../lib/.libs/libcurl.a -lssl -lcrypto -pthread
I'm just wondering if the final -pthread is supposed to be something like -lpthread and the initial -pthread needs to be -qthread, or something like that.
Mike S
=====
Daniel,
Here is the context diff to the configure file:
*** configure.org       Thu Mar 14 19:07:49 2019
--- configure   Thu Mar 14 19:03:55 2019
***************
*** 40582,40594 ****
        *-hp-hpux*)
                    USE_THREADS_POSIX=""
           ;;
        *)
           ;;
        esac
              if test "$USE_THREADS_POSIX" != "1"
        then
-         CFLAGS="$CFLAGS -pthread"
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
  $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
  if ${ac_cv_lib_pthread_pthread_create+:} false; then :
--- 40582,40596 ----
        *-hp-hpux*)
                    USE_THREADS_POSIX=""
           ;;
+       *-ibm-aix*)
+          ;;
        *)
+         CFLAGS="$CFLAGS -pthread"
           ;;
        esac
              if test "$USE_THREADS_POSIX" != "1"
        then
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
  $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
  if ${ac_cv_lib_pthread_pthread_create+:} false; then :
***************
*** 40618,40624 ****
  fi
  rm -f core conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_lib_save_LIBS
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
  $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
--- 40620,40625 ----
***************
*** 40626,40631 ****
--- 40627,40633 ----
    USE_THREADS_POSIX=1
  else
     CFLAGS="$save_CFLAGS"
+    LIBS=$ac_check_lib_save_LIBS
  fi
        fi
I can also send this context diff to you as an attachment.
This allowed the source to compile. Most of the tests passed. 1435 and 1436 failed, but I'll submit a separate email for those.
Mike S
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-03-14