Package: hpanel
Version: 0.3.2-1
Severity: minor
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Dear maintainer,

When building with ld --as-needed, a command line like 
'gcc -lbar foo.o -o foo' will cause -lbar to be ignored by the linker,
because it isn't needed to resolve symbols at the time it is encountered.
Linking then will fail with "Undefined reference". The fix is to pass
libraries after objects so they are considered by the linker.

Your package fails to build with --as-needed:
(https://launchpadlibrarian.net/70249134/buildlog_ubuntu-natty-amd64.hpanel_0.3.2-1_FAILEDTOBUILD.txt.gz)

cc -g -O2 -Wl,-z,defs -I/usr/X11R6/include -I/usr/include/freetype2 -DHAVE_XPM 
-DXFT -DCLOCK -Wl,-z,defs -I/usr/X11R6/include -I/usr/include/freetype2 
-DHAVE_XPM -DXFT -DCLOCK -L/usr/X11R6/lib -lX11 -lXpm -lXft hpanel.c -o hpanel
/tmp/ccx7Izx2.o: In function `get_prop_data':
/build/buildd/hpanel-0.3.2/hpanel.c:157: undefined reference to 
`XGetWindowProperty'
/tmp/ccx7Izx2.o: In function `scale_icon':
/build/buildd/hpanel-0.3.2/hpanel.c:192: undefined reference to `XGetGeometry'
/build/buildd/hpanel-0.3.2/hpanel.c:193: undefined reference to `XCreatePixmap'
/build/buildd/hpanel-0.3.2/hpanel.c:203: undefined reference to `XSetForeground'
/build/buildd/hpanel-0.3.2/hpanel.c:213: undefined reference to `XCopyPlane'
/build/buildd/hpanel-0.3.2/hpanel.c:217: undefined reference to `XCopyArea'
/build/buildd/hpanel-0.3.2/hpanel.c:215: undefined reference to `XCopyArea'
/build/buildd/hpanel-0.3.2/hpanel.c:223: undefined reference to `XFreeGC'
/build/buildd/hpanel-0.3.2/hpanel.c:197: undefined reference to `XCreatePixmap'
/build/buildd/hpanel-0.3.2/hpanel.c:200: undefined reference to `XCreateGC'
/build/buildd/hpanel-0.3.2/hpanel.c:203: undefined reference to `XSetForeground'
[snip]
/build/buildd/hpanel-0.3.2/hpanel.c:1242: undefined reference to `XMoveWindow'
/build/buildd/hpanel-0.3.2/hpanel.c:1261: undefined reference to `XPending'
/build/buildd/hpanel-0.3.2/hpanel.c:1261: undefined reference to `XPending'
/build/buildd/hpanel-0.3.2/hpanel.c:1263: undefined reference to `XNextEvent'
collect2: ld returned 1 exit status

Thanks for considering the patch

- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-999-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages hpanel depends on:
ii  libc6                         2.13-7     Embedded GNU C Library: Shared lib
ii  libx11-6                      2:1.4.3-2  X11 client-side library
ii  libxft2                       2.2.0-3    FreeType-based font drawing librar
ii  libxpm4                       1:3.5.9-1  X11 pixmap library

hpanel recommends no packages.

hpanel suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJOFMfvAAoJEGHzRCZ03mYk3ZoP/RVPmKP6gbA+2VewuDNzg6e7
hGmLiRSRblUxj5OSEpkNcZXKd5YdXQEHXt8lh1bRF7iPfwyC8dOKg0i482WwaemH
oX7ffvEzfaKOFnbWiAQBr0utIqxMiqWurksT9nKGdaHQGVy9lzQPl3yfn9F4Dpp3
bg9IPYWn58PAqwNmeXoWjgA7jofTfyZohc6imea3+AskDhDDC8hzJQsrB5eUTtRi
wZYBQkl2YYKHvlMMy3BEIM8z0yWuhvADCWlW1+UxUpI7PM1grHbp+YsbT3RCnX3P
d/i85pXQ0kOHdLEOEiyeYHlN91E6rTUXTe3wFx6/6uhz502nqB1fI9cvw/C8eiFq
evz7mqSAFWdB9wTgRH0hcAs4mlTi6jiBt9lBxGeDtOb9jsqriMRkwYdRhhlkEanZ
rrmZsRTSFhfsvCjM5pS9c+ZxXXzQpNcM6HjIEq88p8qMkiIRBNMecdbb7Ug6w6T4
XqZB4qG38XdVa6DHPGbmN0hzo/MWhKSkNg1iGqEnnBKWpDJKTtFBIcDCVZuYhbnx
v60ikDsYJJSr91SHemih5UkLfDOVs2JDn8wUlPRlVNlkVaY/khm6qNSfKs7YC5av
oNDJQC5jFZQqp9Gm9MnV7jnRk524kn5NcPxNse5kD4jFwT7yAexvhX8AahEa8buS
+jd+5dQu8YMWOcT7vJlT
=uSqo
-----END PGP SIGNATURE-----
>From 2aa751fa387b16e5a2d468c2501fd677c3dde94b Mon Sep 17 00:00:00 2001
From: Andreas Moog <am...@ubuntu.com>
Date: Wed, 6 Jul 2011 20:31:06 +0000
Subject: [PATCH] Pass libraries in LDADD to fix a problem with ld --as-needed
 (LP: #771057)

---
 debian/changelog                      |    6 ++++++
 debian/patches/20-fix-as-needed.patch |   25 +++++++++++++++++++++++++
 debian/patches/series                 |    1 +
 3 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/20-fix-as-needed.patch

diff --git a/debian/changelog b/debian/changelog
index a613ccd..3ffd484 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+hpanel (0.3.2-1ubuntu1) oneiric; urgency=low
+
+  * Pass libraries in LDADD to fix a problem with ld --as-needed (LP: #771057)
+
+ -- Andreas Moog <am...@ubuntu.com>  Wed, 06 Jul 2011 20:29:54 +0000
+
 hpanel (0.3.2-1) unstable; urgency=low
 
   * Initial release (Closes: #582652).
diff --git a/debian/patches/20-fix-as-needed.patch 
b/debian/patches/20-fix-as-needed.patch
new file mode 100644
index 0000000..5b2e455
--- /dev/null
+++ b/debian/patches/20-fix-as-needed.patch
@@ -0,0 +1,25 @@
+Description: When building with ld --as-needed, a command line like
+ 'gcc -lbar foo.o -o foo' will cause -lbar to be ignored by the linker,
+ because it isn't needed to resolve symbols at the time it is encountered.
+ Linking then will fail with "Undefined reference". The fix is to pass
+ libraries after objects so they are considered by the linker.
+Author: Andreas Moog
+Bug-Ubuntu: https://launchpad.net/bugs/771057
+Last-Update: 2011-07-06
+
+--- hpanel-0.3.2.orig/Makefile
++++ hpanel-0.3.2/Makefile
+@@ -1,10 +1,11 @@
+ CC=cc
+ CFLAGS= -O2 -I/usr/X11R6/include -DHAVE_XPM -DXFT -DCLOCK
+-LDFLAGS= -L/usr/X11R6/lib -lX11 -lXpm -lXft
++LDFLAGS= -L/usr/X11R6/lib
++LDADD = -lX11 -lXpm -lXft
+ PROGNAME=hpanel
+ 
+ $(PROGNAME): Makefile hpanel.c hpanel.h icon.xpm
+-      $(CC) $(CFLAGS) $(LDFLAGS) hpanel.c -o $(PROGNAME)
++      $(CC) $(CFLAGS) $(LDFLAGS) hpanel.c $(LDADD) -o $(PROGNAME)
+       @ls -l $(PROGNAME)
+ #     strip $(PROGNAME)
+       @ls -l $(PROGNAME)
diff --git a/debian/patches/series b/debian/patches/series
index b719a7a..c225b18 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 10-Makefile.patch
+20-fix-as-needed.patch
-- 
1.7.5.4

Reply via email to