Package: atom4
Version: 4.1-8
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu artful ubuntu-patch

Dear maintainer,

In Ubuntu, atom 4.1-8 fails to build because of a linker error:

g++ -o atom4 atom4.o interface.o obj/event.o obj/textui.o -Lproglib/lib -Llib 
-L/usr/X11R6/lib -lt++ -lpanel -lncurses -lX11 -lXpm -latom4 -lxatom4
lib/libxatom4.a(xatom4.o): In function `XAtom4::key_press(XKeyEvent)':
xatom4.cc:(.text+0x25c): undefined reference to `XLookupKeysym'
lib/libxatom4.a(xatom4.o): In function `XAtom4::XAtom4(xconnection*, atom4*, 
int*)':
xatom4.cc:(.text+0x40e): undefined reference to `XSelectInput'
xatom4.cc:(.text+0x41a): undefined reference to `XMapSubwindows'
[...]

  https://launchpad.net/ubuntu/+source/atom4/4.1-8/+build/12497410

This is because Ubuntu uses -Wl,--as-needed by default, and the libraries on
the linker command line are not listed in dependency order.
(https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed)

I have uploaded the attached patch to Ubuntu which fixes this issue.  Please
consider applying it in Debian and forwarding it upstream.

Thanks,
-- 
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                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru atom4-4.1/debian/patches/series atom4-4.1/debian/patches/series
--- atom4-4.1/debian/patches/series     2017-04-04 14:09:10.000000000 -0700
+++ atom4-4.1/debian/patches/series     2017-08-20 21:08:26.000000000 -0700
@@ -2,3 +2,4 @@
 constchar
 constchar2
 unsigned
+Wl-as-needed
diff -Nru atom4-4.1/debian/patches/Wl-as-needed 
atom4-4.1/debian/patches/Wl-as-needed
--- atom4-4.1/debian/patches/Wl-as-needed       1969-12-31 16:00:00.000000000 
-0800
+++ atom4-4.1/debian/patches/Wl-as-needed       2017-08-20 21:14:57.000000000 
-0700
@@ -0,0 +1,33 @@
+Description: List lib dependencies in the right order for -Wl,--as-needed
+ With -Wl,--as-needed, libraries which don't provide any symbols that are
+ referenced are dropped from the final linkage, which means libraries must
+ be listed on the commandline after what depends on them in order to avoid a
+ build failure.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+
+Index: atom4-4.1/Construct
+===================================================================
+--- atom4-4.1.orig/Construct
++++ atom4-4.1/Construct
+@@ -88,7 +88,7 @@
+ # Local configuration
+ $INCPATH  = "$INCDIR:$PROGLIBPATH/include";
+ $LIBPATH  = "$PROGLIBPATH/lib:$LIBDIR:$X11LIBPATH";
+-$LIBS     = "$PROGLIB $NCURSESLIB $X11LIB -latom4 -lxatom4";
++$LIBS     = "$PROGLIB -lxatom4 -latom4 $NCURSESLIB $X11LIB";
+ $LIBS    .= " -pg" if $PROFILE;
+ 
+ $CONS = new cons(
+Index: atom4-4.1/SConstruct
+===================================================================
+--- atom4-4.1.orig/SConstruct
++++ atom4-4.1/SConstruct
+@@ -57,7 +57,7 @@
+ # Local configuration
+ incpath  = [ incdir, proglibpath + '/include' ]
+ libpath  = [ proglibpath + '/lib', libdir, x11libpath ]
+-libs     = [ proglib, ncurseslib, x11lib, '-latom4', '-lxatom4' ];
++libs     = [ proglib, '-lxatom4', '-latom4', ncurseslib, x11lib ];
+ if profile:
+       libs += '-pg'
+ 

Reply via email to