Package: ries
Version: 2018.04.11-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch

Dear Nicolas,

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

[...]
cc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lm  ries.o   -o ries
/usr/bin/ld: ries.o: in function `ries_to_digits':
./ries.c:3834: undefined reference to `log10'
/usr/bin/ld: ries.o: in function `exec':
./ries.c:5774: undefined reference to `pow'
/usr/bin/ld: ./ries.c:5445: undefined reference to `exp'
/usr/bin/ld: ./ries.c:5510: undefined reference to `sincos'
/usr/bin/ld: ./ries.c:5715: undefined reference to `pow'
/usr/bin/ld: ./ries.c:5553: undefined reference to `tan'
/usr/bin/ld: ./ries.c:5463: undefined reference to `sincos'
/usr/bin/ld: ./ries.c:5835: undefined reference to `log'
/usr/bin/ld: ./ries.c:5836: undefined reference to `log'
/usr/bin/ld: ./ries.c:5424: undefined reference to `log'
/usr/bin/ld: ./ries.c:5717: undefined reference to `log'
/usr/bin/ld: ./ries.c:5776: undefined reference to `log'
/usr/bin/ld: ./ries.c:5385: undefined reference to `sqrt'
/usr/bin/ld: ries.o: in function `parse_args':
./ries.c:11608: undefined reference to `floor'
/usr/bin/ld: ./ries.c:11521: undefined reference to `pow'
/usr/bin/ld: ries.o: in function `main':
./ries.c:12449: undefined reference to `floor'
/usr/bin/ld: ./ries.c:12254: undefined reference to `pow'
collect2: error: ld returned 1 exit status
[...]

  (https://launchpad.net/ubuntu/+source/ries/2018.04.11-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.

I have uploaded the attached patch to ries in 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 ries-2018.04.11/debian/patches/library-link-order.patch 
ries-2018.04.11/debian/patches/library-link-order.patch
--- ries-2018.04.11/debian/patches/library-link-order.patch     1969-12-31 
16:00:00.000000000 -0800
+++ ries-2018.04.11/debian/patches/library-link-order.patch     2018-08-22 
14:54:05.000000000 -0700
@@ -0,0 +1,21 @@
+Description: Ensure libraries linked are listed after objects using them
+ The Ubuntu toolchain uses -Wl,--as-needed by default, which causes
+ libraries to be dropped from the final binary if they aren't used.  For
+ portability, make sure that libraries are always listed on the linker
+ commandline /after/ the objects that reference them.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Modified: 2018-08-22
+
+Index: ries-2018.04.11/GNUmakefile
+===================================================================
+--- ries-2018.04.11.orig/GNUmakefile
++++ ries-2018.04.11/GNUmakefile
+@@ -2,7 +2,7 @@
+ # Licensed under the GNU Public License, version 3 or later
+ 
+ CFLAGS?=-g -O2 -fstack-protector-strong -D_FORTIFY_SOURCE=2
+-LDFLAGS+= -lm
++LDLIBS+= -lm
+ 
+ ries: ries.o
+ 
diff -Nru ries-2018.04.11/debian/patches/series 
ries-2018.04.11/debian/patches/series
--- ries-2018.04.11/debian/patches/series       1969-12-31 16:00:00.000000000 
-0800
+++ ries-2018.04.11/debian/patches/series       2018-08-22 14:15:08.000000000 
-0700
@@ -0,0 +1 @@
+library-link-order.patch

Reply via email to