Package: gtk-chtheme
Version: 0.3.1-5
Severity: normal
Tags: patch
User: [email protected]
Usertags: ld-as-needed

The package fails to build when --as-needed linker option is enabled,
because of incorrect order of parameters passed to ld. Here's a log of
failed build in Ubuntu:
https://launchpadlibrarian.net/70850221/buildlog_ubuntu-oneiric-i386.gtk-chtheme_0.3.1-5_FAILEDTOBUILD.txt.gz

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

The attached patch was used in Ubuntu to fix the problem.
https://launchpad.net/ubuntu/+source/gtk-chtheme/0.3.1-5ubuntu1

-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric
  APT policy: (500, 'oneiric')
Architecture: i386 (i686)

Kernel: Linux 2.6.38-10-generic (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Description: Place libraries after object files in linker call, allowing to
 build with --as-needed option.
Author: Ilya Barygin <[email protected]>
Bug-Ubuntu: https://launchpad.net/bugs/749277
--- gtk-chtheme-0.3.1.orig/Makefile
+++ gtk-chtheme-0.3.1/Makefile
@@ -2,7 +2,7 @@ include Metadata
 
 CFLAGS := $(if $(RPM_OPT_FLAGS), $(RPM_OPT_FLAGS), $(CFLAGS))
 
-LDFLAGS = $(shell pkg-config --libs gtk+-2.0)
+LIBS = $(shell pkg-config --libs gtk+-2.0)
 CFLAGS += -Wall
 CFLAGS += $(shell pkg-config --cflags gtk+-2.0) -DGTK_DISABLE_BROKEN -DGTK_DISABLE_DEPRECATED
 CFLAGS += -DPROJNAME='"$(PROJNAME)"' -DVERSION='"$(VERSION)"'
@@ -17,7 +17,7 @@ EXTRAS = $(addprefix $(EXENAME), .spec .
 all: $(EXENAME) $(EXENAME).1
 
 $(EXENAME): $(addsuffix .o, $(SRC))
-	$(CC) $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
 
 $(EXENAME).1: $(EXENAME).pod
 	pod2man $< | sed 's/^\.TH .*/.TH $(EXENAME) 1/' > $@

Reply via email to