Package: unanimity
Version: 3.3.0+dfsg-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch

Dear maintainers,

The unanimity package fails to build in Ubuntu because it supplies options
to the linker in the wrong order:

[...]
[ 95%] Linking CXX executable ../gcpp
cd /<<BUILDDIR>>/unanimity-3.3.0+dfsg/build/src && /usr/bin/cmake -E 
cmake_link_script CMakeFiles/gcpp.dir/link.txt --verbose=1
/usr/bin/c++  -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/unanimity-3.3.0+dfsg=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable 
-Wno-unused-local-typedefs  -lpthread  -rdynamic 
CMakeFiles/gcpp.dir/main/gcpp.cpp.o  -o ../gcpp -ldl libunanimity.a libcc2.a 
-lpbbam -Wl,-Bstatic -lpbcopper -Wl,-Bdynamic 
/usr/bin/ld: libunanimity.a(Workflow.cpp.o): undefined reference to symbol 
'pthread_create@@GLIBC_2.2.5'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libpthread.so: error 
adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[...]

  (https://launchpad.net/ubuntu/+source/unanimity/3.3.0+dfsg-1)

Per <https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed>,
libraries must be passed on the commandline after the objects which
reference them, otherwise they will be discarded by the linker, resulting in
errors such as the above.

In the case of unanimity, the out-of-order option that's being passed is
-lpthread, which is specified in debian/rules.  However, if we pass -pthread
instead of -lpthread, gcc knows to put the options in the right order when
passing to ld.  So attached is a simple patch to fix this issue.

I have uploaded this patch to Ubuntu.  Please consider applying it in Debian
as well.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru unanimity-3.3.0+dfsg/debian/rules unanimity-3.3.0+dfsg/debian/rules
--- unanimity-3.3.0+dfsg/debian/rules   2019-01-24 02:40:05.000000000 -0800
+++ unanimity-3.3.0+dfsg/debian/rules   2019-01-31 21:22:11.000000000 -0800
@@ -44,7 +44,7 @@
 
 config-main:
        dh_auto_configure -- \
-       -DCMAKE_EXE_LINKER_FLAGS="-lpthread" \
+       -DCMAKE_EXE_LINKER_FLAGS=-pthread \
        -DUNY_build_tests=OFF \
        -DPYTHON_SWIG=ON \
        -DZLIB_INCLUDE_DIRS=$(INCLUDE) \

Reply via email to