CC: | mgorny [...] gentoo.org |
Subject: | missing -lpthread (or -pthread) while linking shared library |
This is a clone of https://bugs.gentoo.org/show_bug.cgi?id=595098
dev-perl:XML-LibXML-2.12.800:20160925-123556.log
When building with -Wl,-z,defs:
LD_RUN_PATH="/usr/lib64:/lib64" x86_64-pc-linux-gnu-gcc-5.4.0 -shared -march=k8-sse3 -mcx16 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -O2 -pipe -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu Av_CharPtrPtr.o Devel.o LibXML.o dom.o perl-libxml-mm.o perl-libxml-sax.o xpath.o -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,-z,defs -Wl,--no-allow-shlib-undefined -o blib/arch/auto/XML/LibXML/LibXML.so \
-lxml2 -lz -llzma -licui18n -licuuc -licudata -lm -ldl \
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: Av_CharPtrPtr.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
While this isn't strictly required, it would be nice not to rely on some other executable linking in libpthread implicitly. dev-perl/XML-LibXSLT seems to get this right.