View Ticket
Not logged in
Ticket Hash: 4670684140648c2d35e639dc20d3e870858673f0
Title: ld: wmslite.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
Status: Open Type: Build_Problem
Severity: Critical Priority: Immediate
Subsystem: Resolution: Open
Last Modified: 2020-09-28 04:20:31
Version Found In: 1.1.0-beta1
User Comments:
anonymous added on 2020-09-28 03:55:38:
It seems that librasterlite2 doesn't link pthread correctly.


As reported by Lucas Nussbaum in Debian Bug 971132 (https://bugs.debian.org/971132):
"
During a rebuild of all packages in sid, your package failed to build
on amd64.

Relevant part (hopefully):
> /bin/bash ../libtool  --tag=CC   --mode=link gcc -I/usr/include/libpng16 -I/usr/include/openjpeg-2.3 -I/usr/include/x86_64-linux-gnu -I/usr/include/libxml2 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -L../src  -Wl,-z,relro -Wl,-z,now -o wmslite wmslite.o -lpng16 -lz -lwebp -llzma -llz4 -lzstd -lopenjp2 -lcurl -lxml2 -lfontconfig -lfreetype -lfreetype -lpixman-1 -lcairo -lspatialite -lrasterlite2  -lminizip -lproj -lgeotiff -ltiff -lgif -ljpeg -lz -lsqlite3 
> libtool: link: gcc -I/usr/include/libpng16 -I/usr/include/openjpeg-2.3 -I/usr/include/x86_64-linux-gnu -I/usr/include/libxml2 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -g -O2 "-fdebug-prefix-map=/<<PKGBUILDDIR>>=." -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/wmslite wmslite.o  -L../src -lpng16 -lwebp -llzma -llz4 -lzstd -lopenjp2 -lcurl -lxml2 -lfontconfig -lfreetype -lpixman-1 -lcairo -lspatialite /<<PKGBUILDDIR>>/src/.libs/librasterlite2.so -lminizip /usr/lib/x86_64-linux-gnu/libproj.so -lgeotiff -ltiff -lgif -ljpeg -lz /usr/lib/x86_64-linux-gnu/libsqlite3.so
> /usr/bin/ld: wmslite.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
> /usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status

The full build log is available from:
   http://qa-logs.debian.net/2020/09/26/librasterlite2_1.1.0~beta1-1_unstable.log

A list of current common problems and possible solutions is available at
http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!

About the archive rebuild: The rebuild was done on EC2 VM instances from
Amazon Web Services, using a clean, minimal and up-to-date chroot. Every
failed build was retried once to eliminate random failures.
"

anonymous added on 2020-09-28 04:20:31:
This patch works for me to fix the issue on Debian unstable:

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,8 +30,8 @@ if MINGW
 librasterlite2_la_LDFLAGS = -avoid-version -no-undefined
 librasterlite2_la_LIBADD += -lm
 else
-librasterlite2_la_LDFLAGS = -version-info 1:0:0
-librasterlite2_la_LIBADD += -lpthread -lm
+librasterlite2_la_LDFLAGS = -version-info 1:0:0 -pthread
+librasterlite2_la_LIBADD += -lm
 endif
 
 mod_rasterlite2_la_SOURCES = rasterlite2.c rl2raw.c rl2codec.c \
@@ -58,8 +58,8 @@ if MINGW
 mod_rasterlite2_la_LDFLAGS = -module -avoid-version -no-undefined
 mod_rasterlite2_la_LIBADD += -lm
 else
-mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0
-mod_rasterlite2_la_LIBADD += -lpthread -lm
+mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0 -pthread
+mod_rasterlite2_la_LIBADD += -lm
 endif
 
 MOSTLYCLEANFILES = *.gcna *.gcno *.gcda