On Tue, Mar 08, 2011 at 10:19:16PM +0100, Guido Günther wrote:
On Tue, Mar 08, 2011 at 06:57:02PM +0000, Daniel P. Berrange wrote:
[..snip..]
> > -libvirtd_LDADD += ../src/libvirt.la
> > +if WITH_SECDRIVER_SELINUX
> > + libvirtd_LDADD += $(SELINUX_LIBS)
> > +endif
> > +if WITH_SECDRIVER_APPARMOR
> > + libvirtd_LDADD += $(APPARMOR_LIBS)
> > +endif
> > +
> > +libvirtd_LDADD += ../src/libvirt.la \
> > + $(CAPNG_LIBS)
>
> This isn't correct. The individual drivers which uses these libraries
> should be specifying them in their LDADD in src/Makefile.am. Then libvirtd
> gets the link when libtool adds the drivers.
I took the above path since we otherwise have to add this in several
places. Does the attached version look better?`
Yep, although you need to add it in more places, it is desirable to
do it the long way, since then it is clear what drivers are depending
on each library.
From 1ac02a4b8729d6e5cf125e30a96b83e68fe26672 Mon Sep 17 00:00:00
2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx(a)sigxcpu.org>
Date: Tue, 8 Mar 2011 21:44:14 +0100
Subject: [PATCH] libvirtd: Remove indirect linking
as described at
http://wiki.debian.org/ToolChain/DSOLinking
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
otherwise the build fails on current Debian unstable with:
CCLD libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_lxc.a(libvirt_driver_lxc_la-lxc_container.o):
undefined reference to symbol 'capng_apply'
/usr/bin/ld: note: 'capng_apply' is defined in DSO //usr/lib/libcap-ng.so.0 so
try adding it to the linker command line
CCLD libvirtd
/usr/bin/ld:
../src/.libs/libvirt_driver_storage.a(libvirt_driver_storage_la-storage_backend.o):
undefined reference to symbol 'fgetfilecon'
/usr/bin/ld: note: 'fgetfilecon' is defined in DSO //lib/libselinux.so.1 so try
adding it to the linker command line
//lib/libselinux.so.1: could not read symbols: Invalid operation
and similar errors.
---
src/Makefile.am | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 25f0e48..645119e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -703,7 +703,8 @@ endif
libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS)
+libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS) \
+ $(CAPNG_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
@@ -730,8 +731,15 @@ noinst_LTLIBRARIES += libvirt_driver_lxc.la
endif
libvirt_driver_lxc_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
+libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS)
+if WITH_SECDRIVER_SELINUX
+libvirt_driver_lxc_la_LIBADD += $(SELINUX_LIBS)
+endif
+if WITH_SECDRIVER_APPARMOR
+libvirt_driver_lxc_la_LIBADD += $(APPARMOR_LIBS)
+endif
if WITH_DRIVER_MODULES
-libvirt_driver_lxc_la_LIBADD = ../gnulib/lib/libgnu.la
+libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
@@ -870,6 +878,12 @@ libvirt_driver_storage_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
libvirt_driver_storage_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_storage_la_LIBADD =
+if WITH_SECDRIVER_SELINUX
+libvirt_driver_storage_la_LIBADD += $(SELINUX_LIBS)
+endif
+if WITH_SECDRIVER_APPARMOR
+libvirt_driver_storage_la_LIBADD += $(APPARMOR_LIBS)
+endif
if WITH_STORAGE_DIR
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_storage.la
ACK, though I'm surprised that LXC requires the SELinux
or AppArmour bits.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|