[Lcdproc] [Patch] Compile error with --as-needed
Robert Buchholz
rob@thetruth.de
Thu Nov 23 12:17:01 2006
This is a multi-part message in MIME format.
--------------090502060602000309020101
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Hi,
as noted in Gentoo Bug #155587 [1], lcdproc does not compile when the
LDFLAG "--as-needed" is set.
The reason is that the shared/libLCDstuff.a needs the ldap libraries,
but with --as-needed, the order of the libraries is important:
@ldap_libs@ ../../shared/libLCDstuff.a
will not work, while
../../shared/libLCDstuff.a @ldap_libs@
will work.
As [2] puts it:
"Basically, what the linker does is look for the symbols missing in a
given file (either an object file, a static archive or a library) only
in the files coming after it. When using the normal linking, without
--as-needed, this is not a problem, although there might be some
internal drawbacks on the linking stage, the files are linked together
without considering ordering. But with the flag, the libraries that
aren't used for resolving symbols are discarded and thus not linked."
A patch against the 0.5.1 release is included.
Bye,
Robert
[1] http://bugs.gentoo.org/155587
[2] http://www.gentoo.org/proj/en/qa/asneeded.xml
--------------090502060602000309020101
Content-Type: text/x-patch;
name="0.5.1-as-needed.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="0.5.1-as-needed.patch"
diff -ru --exclude=Makefile.in lcdproc-0.5.1-orig/clients/lcdexec/Makefile.am lcdproc-0.5.1/clients/lcdexec/Makefile.am
--- lcdproc-0.5.1-orig/clients/lcdexec/Makefile.am 2006-11-18 15:50:52.000000000 +0100
+++ lcdproc-0.5.1/clients/lcdexec/Makefile.am 2006-11-18 16:02:48.000000000 +0100
@@ -6,7 +6,7 @@
lcdexec_SOURCES = lcdexec.c menu.c menu.h
-lcdexec_LDADD = @ldap_libs@ ../../shared/libLCDstuff.a
+lcdexec_LDADD = ../../shared/libLCDstuff.a @ldap_libs@
AM_CPPFLAGS = -I$(top_srcdir) -DSYSCONFDIR=\"$(sysconfdir)\"
diff -ru --exclude=Makefile.in lcdproc-0.5.1-orig/clients/lcdproc/Makefile.am lcdproc-0.5.1/clients/lcdproc/Makefile.am
--- lcdproc-0.5.1-orig/clients/lcdproc/Makefile.am 2006-11-18 15:50:52.000000000 +0100
+++ lcdproc-0.5.1/clients/lcdproc/Makefile.am 2006-11-18 16:04:31.000000000 +0100
@@ -6,7 +6,7 @@
lcdproc_SOURCES = main.c main.h mode.c mode.h batt.c batt.h chrono.c chrono.h cpu.c cpu.h cpu_smp.c cpu_smp.h disk.c disk.h load.c load.h mem.c mem.h eyebox.c eyebox.h machine.h machine_Linux.c machine_OpenBSD.c machine_FreeBSD.c machine_NetBSD.c machine_Darwin.c machine_SunOS.c util.c util.h iface.c iface.h
-lcdproc_LDADD = @ldap_libs@ ../../shared/libLCDstuff.a
+lcdproc_LDADD = ../../shared/libLCDstuff.a @ldap_libs@
if DARWIN
AM_LDFLAGS = -framework CoreFoundation -framework IOKit
diff -ru --exclude=Makefile.in lcdproc-0.5.1-orig/clients/lcdvc/Makefile.am lcdproc-0.5.1/clients/lcdvc/Makefile.am
--- lcdproc-0.5.1-orig/clients/lcdvc/Makefile.am 2006-11-18 15:50:52.000000000 +0100
+++ lcdproc-0.5.1/clients/lcdvc/Makefile.am 2006-11-18 16:05:05.000000000 +0100
@@ -6,7 +6,7 @@
lcdvc_SOURCES = lcdvc.c lcdvc.h lcd_link.c lcd_link.h vc_link.c vc_link.h
-lcdvc_LDADD = @ldap_libs@ ../../shared/libLCDstuff.a
+lcdvc_LDADD = ../../shared/libLCDstuff.a @ldap_libs@
if DARWIN
AM_LDFLAGS = -framework CoreFoundation -framework IOKit
diff -ru --exclude=Makefile.in lcdproc-0.5.1-orig/server/Makefile.am lcdproc-0.5.1/server/Makefile.am
--- lcdproc-0.5.1-orig/server/Makefile.am 2006-11-18 15:50:52.000000000 +0100
+++ lcdproc-0.5.1/server/Makefile.am 2006-11-18 16:07:07.000000000 +0100
@@ -6,7 +6,7 @@
LCDd_SOURCES= client.c client.h clients.c clients.h input.c input.h main.c main.h menuitem.c menuitem.h menu.c menu.h menuscreens.c menuscreens.h parse.c parse.h render.c render.h screen.c screen.h screenlist.c screenlist.h serverscreens.c serverscreens.h sock.c sock.h widget.c widget.h drivers.c drivers.h driver.c driver.h
-LDADD = @ldap_libs@ ../shared/libLCDstuff.a commands/libLCDcommands.a
+LDADD = ../shared/libLCDstuff.a commands/libLCDcommands.a @ldap_libs@
if !DARWIN
AM_LDFLAGS = -rdynamic -uget_args
--------------090502060602000309020101--