Package: gnurobots
Version: 2:1.2.0-4
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch oneiric

gnurobots fails to build with a linker that defaults to --as-needed, as
shown in this Ubuntu bug report:

  https://bugs.launchpad.net/ubuntu/+source/gnurobots/+bug/770760

This is because of incorrect link ordering: it puts libraries before the
objects that use them rather than after.  See:

  http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The following patch fixes this.

  * Fix link order to list libraries after the objects that require them.

diff -u gnurobots-1.2.0/debian/patches/series 
gnurobots-1.2.0/debian/patches/series
--- gnurobots-1.2.0/debian/patches/series
+++ gnurobots-1.2.0/debian/patches/series
@@ -1,0 +2 @@
+01_link_order.patch
only in patch2:
unchanged:
--- gnurobots-1.2.0.orig/debian/patches/01_link_order.patch
+++ gnurobots-1.2.0/debian/patches/01_link_order.patch
@@ -0,0 +1,53 @@
+Description: List libraries after the objects that require them
+Author: Colin Watson <[email protected]>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/770760
+Forwarded: no
+Last-Update: 2011-09-12
+
+Index: b/src/Makefile.am
+===================================================================
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -28,5 +28,5 @@
+ 
+ gnurobots_SOURCES = main.c api.c map.c grobot.c \
+               ui-window.c ui-cmdwin.c ui-arena.c
+-gnurobots_LDFLAGS = $(GUILE_LDFLAGS) $(READLINE_LIBS) $(GTHREAD2_LIBS) \
++gnurobots_LDADD = $(GUILE_LDFLAGS) $(READLINE_LIBS) $(GTHREAD2_LIBS) \
+               $(GTK2_LIBS) $(VTE_LIBS) -lutil
+Index: b/src/Makefile.in
+===================================================================
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -47,9 +47,10 @@
+       grobot.$(OBJEXT) ui-window.$(OBJEXT) ui-cmdwin.$(OBJEXT) \
+       ui-arena.$(OBJEXT)
+ gnurobots_OBJECTS = $(am_gnurobots_OBJECTS)
+-gnurobots_LDADD = $(LDADD)
+-gnurobots_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(gnurobots_LDFLAGS) \
+-      $(LDFLAGS) -o $@
++am__DEPENDENCIES_1 =
++gnurobots_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
++      $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
++      $(am__DEPENDENCIES_1)
+ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+ depcomp = $(SHELL) $(top_srcdir)/depcomp
+ am__depfiles_maybe = depfiles
+@@ -174,7 +175,7 @@
+ gnurobots_SOURCES = main.c api.c map.c grobot.c \
+               ui-window.c ui-cmdwin.c ui-arena.c
+ 
+-gnurobots_LDFLAGS = $(GUILE_LDFLAGS) $(READLINE_LIBS) $(GTHREAD2_LIBS) \
++gnurobots_LDADD = $(GUILE_LDFLAGS) $(READLINE_LIBS) $(GTHREAD2_LIBS) \
+               $(GTK2_LIBS) $(VTE_LIBS) -lutil
+ 
+ all: all-am
+@@ -235,7 +236,7 @@
+       -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ gnurobots$(EXEEXT): $(gnurobots_OBJECTS) $(gnurobots_DEPENDENCIES) 
+       @rm -f gnurobots$(EXEEXT)
+-      $(gnurobots_LINK) $(gnurobots_OBJECTS) $(gnurobots_LDADD) $(LIBS)
++      $(LINK) $(gnurobots_OBJECTS) $(gnurobots_LDADD) $(LIBS)
+ 
+ mostlyclean-compile:
+       -rm -f *.$(OBJEXT)

Thanks,

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to