Dmitry V. Levin wrote: > According to the log, it was libtool that broke a valid command > > /bin/sh ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -O2 -g > -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 > -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong > -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic > -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection > -Wl,-z,relro -Wl,--as-needed -Wl,-z,now > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o test-rwlock1 test-rwlock1.o > libtests.a ../../gnulib/lib/libgnu.la libtests.a -pthread -Wl,--push-state > -Wl,--no-as-needed -lpthread -Wl,--pop-state -lrt > > into an invalid command > > libtool: link: gcc -O2 -g -pipe -Wall -Werror=format-security > -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions > -fstack-protector-strong -grecord-gcc-switches > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic > -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wl,-z > -Wl,relro -Wl,--as-needed -Wl,-z -Wl,now > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o test-rwlock1 test-rwlock1.o > -pthread -Wl,--push-state -Wl,--no-as-needed -Wl,--pop-state libtests.a > ../../gnulib/lib/.libs/libgnu.a libtests.a -lpthread -lrt -pthread > > What's the version of libtool that's produced such a mess?
Even the latest released libtool versions do this. This patch should fix the issue. Pushed. 2019-01-23 Bruno Haible <br...@clisp.org> thread: Force linking with -lpthread, even when --as-needed is in use. Reported by Richard W.M. Jones <rjo...@redhat.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2019-01/msg00123.html>. * lib/glthread/thread.h (pthread_create): Don't declare weak. diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index ca40508..1d2a544 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -133,8 +133,6 @@ extern int glthread_in_use (void); call to foo(...) in the same function. To avoid this, we test the address of a function in libpthread that we don't use. */ -# pragma weak pthread_create - # ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak. */ # pragma weak pthread_sigmask # endif