Hi, A special "feature" in libtool 1.5.24 is making some multithreaded programs nonfunctional on HP-UX 11.00.
To reproduce: Get and unpack http://www.haible.de/bruno/gnu/gettext-0.16.2-pre6.tar.gz . $ export PATH=/usr/bin:$PATH $ export CC="cc -Ae" CXX="aCC" $ cd gettext-0.16.2-pre6 $ ./configure $ make $ cd gettext-tools/gnulib-tests $ make test-lock source='test-lock.c' object='test-lock.o' libtool=no \ DEPDIR=.deps depmode=hp /bin/sh ../../build-aux/depcomp \ cc -Ae -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I./.. -I../gnulib-lib -I./../gnulib-lib -g -c test-lock.c /bin/sh ../libtool --tag=CC --mode=link cc -Ae -g -o test-lock test-lock.o ../gnulib-lib/libgettextlib.la -lpthread -lrt mkdir .libs chmod 777 .libs libtool: link: warning: this platform does not like uninstalled shared libraries libtool: link: `test-lock' will be relinked during installation cc -Ae -g -o .libs/test-lock test-lock.o ../gnulib-lib/.libs/libgettextlib.sl /udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs/libintl.sl -lc -lcurses -lpthread -lrt -Wl,+b -Wl,/udd/marceau/gettext-0.16.2-pre6/gettext-tools/gnulib-lib/.libs:/udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs:/usr/local/lib creating test-lock $ ./test-lock Starting test_lock ...ABORT instruction The problem is that pthread_create() returns ENOSYS instead of creating a thread and returning 0. [1] explains that pthread_create is only a stub in libc, and well defined in libpthread. If a program is linked with "-lc -lpthread", the stub in libc will take precedence. If a program is linked with just "-lpthread", or with "-lpthread -lc", the well defined function in libpthread takes precedence. test-lock was created like this: /bin/sh ../libtool --tag=CC --mode=link cc -Ae -g -o test-lock \ test-lock.o ../gnulib-lib/libgettextlib.la -lpthread -lrt So I try to put the -lpthread once before and once after libgettextlib.la: $ /bin/sh ../libtool --tag=CC --mode=link cc -Ae -g -o test-lock \ test-lock.o -lpthread ../gnulib-lib/libgettextlib.la -lpthread -lrt libtool: link: warning: this platform does not like uninstalled shared libraries libtool: link: `test-lock' will be relinked during installation cc -Ae -g -o .libs/test-lock test-lock.o ../gnulib-lib/.libs/libgettextlib.sl /udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs/libintl.sl -lc -lcurses -lpthread -lrt -Wl,+b -Wl,/udd/marceau/gettext-0.16.2-pre6/gettext-tools/gnulib-lib/.libs:/udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs:/usr/local/lib creating test-lock $ ./test-lock Starting test_lock ...ABORT instruction As you can see, this had no effect on the cc command line: libtool has moved the -lpthread so that it comes after -lc. So I try to create the test-lock program differently, bypassing libtool: $ cc -Ae -g -o .libs/test-lock test-lock.o ../gnulib-lib/.libs/libgettextlib.sl /udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs/libintl.sl -lpthread -lc -lcurses -lrt -Wl,+b -Wl,/udd/marceau/gettext-0.16.2-pre6/gettext-tools/gnulib-lib/.libs:/udd/marceau/gettext-0.16.2-pre6/gettext-tools/intl/.libs:/usr/local/lib $ ./test-lock Starting test_lock ... OK Starting test_rwlock ... OK Starting test_recursive_lock ... OK Starting test_once ... OK Conclusion: libtool's positioning of -lc before -lpthread causes the problem. The -lc actually comes from the libintl library: It is created through /bin/sh ../libtool --mode=link cc -Ae -g -o libintl.la gettext.lo ... \ -lc -version-info 8:1:0 -rpath /usr/local/lib -no-undefined and without the "-lc" the -no-undefined option causes an error on many platforms. The value of build_libtool_need_lc is irrelevant for this issue. I can solve the problem by omitting the -lc from the libtool command line for libintl (specially for HP-UX). But why is libtool reordering my link specifications at all? Bruno [1] http://docs.hp.com/en/1896/pthreads.html _______________________________________________ Bug-libtool mailing list Bug-libtool@gnu.org http://lists.gnu.org/mailman/listinfo/bug-libtool