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?`
Cheers,
 -- Guido
>From 1ac02a4b8729d6e5cf125e30a96b83e68fe26672 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <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
-- 
1.7.4.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to