--- Begin Message ---
- To: "Debian Bug Tracking System" <submit@bugs.debian.org>
- Subject: gtklp: FTBFS with ld --as-needed
- From: "Michael Bienia" <geser@ubuntu.com>
- Date: 1 May 2012 16:19:07 +0200
- Message-id: <20120501141906.GA20908@vorlon.ping.de>
Package: gtklp
Version: 1.2.7-2.3
Severity: normal
Tags: patch
User: debian-gcc@lists.debian.org
Usertags: ld-as-needed
Hello,
trying to build gtklp in Ubuntu (which uses ld --as-needed by default)
resulted in the following linking error:
,----[ https://launchpadlibrarian.net/103699915/buildlog_ubuntu-quantal-i386.gtklp_1.2.7-2.3_FAILEDTOBUILD.txt.gz ]-
| libtool: link: gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -o gtklp file.o general.o gtklp.o gtklp_functions.o gtklptab.o hpgl2.o image.o output.o ppd.o special.o text.o -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -L/usr/lib/i386-linux-gnu -lX11 ../libgtklp/libgtklp.a -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 /usr/lib/i386-linux-gnu/libcairo.so -lpango-1.0 /usr/lib/i386-linux-gnu/libfreetype.so -lfontconfig -lgobject-2.0 -lglib-2.0 -lcups -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lgnutls -L/lib/i386-linux-gnu -lgcrypt -lz -lpthread -lcrypt -lm
| /usr/bin/ld: ../libgtklp/libgtklp.a(libgtklp.o): undefined reference to symbol 'XOpenDisplay'
| /usr/bin/ld: note: 'XOpenDisplay' is defined in DSO /usr/lib/i386-linux-gnu/libX11.so so try adding it to the linker command line
`----
Although -lX11 is in the linker call the problem is in the argument
order (it's listed before libgtklp.a).
The patch from bug #554752 fixed only linking with --no-add-needed but
not with --as-needed.
Attached is a fixed patch which adds -lX11 to gtklp_LDADD (in
gtklp/Makefile.am) instead of LDFLAGS, fixing linking both with
--no-add-needed and --as-needed.
Regards,
Michael
Index: gtklp-1.2.7/gtklp/Makefile.am
===================================================================
--- gtklp-1.2.7.orig/gtklp/Makefile.am 2009-06-21 14:25:37.000000000 +0200
+++ gtklp-1.2.7/gtklp/Makefile.am 2012-05-01 16:04:00.000000000 +0200
@@ -9,5 +9,5 @@
duplex_short.xpm logo.xpm logo2.xpm logo2_k.xpm logo_k.xpm rarrow.xpm \
white.xpm
-gtklp_LDADD = $(top_builddir)/libgtklp/libgtklp.a $(GTK2_LIBS) $(GTK_LIBS) $(CUPS_LIBS) $(FORTE_LDFLAGS)
+gtklp_LDADD = $(top_builddir)/libgtklp/libgtklp.a -lX11 $(GTK2_LIBS) $(GTK_LIBS) $(CUPS_LIBS) $(FORTE_LDFLAGS)
gtklp_LDFLAGS = $(CUPS_LDFLAGS)
--- End Message ---