[libvirt] [PATCH 2/2] 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 O.k. to apply? Cheers, -- Guido --- daemon/Makefile.am | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 912440c..2083084 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -145,7 +145,15 @@ if WITH_NWFILTER endif endif -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) if HAVE_POLKIT if HAVE_POLKIT0 -- 1.7.4.1

On Tue, Mar 08, 2011 at 07:36:21PM +0100, Guido Günther wrote:
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
O.k. to apply? Cheers, -- Guido
--- daemon/Makefile.am | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 912440c..2083084 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -145,7 +145,15 @@ if WITH_NWFILTER endif endif
-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. 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 :|

-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
On Tue, Mar 08, 2011 at 06:57:02PM +0000, Daniel P. Berrange wrote: [..snip..] places. Does the attached version look better?` Cheers, -- Guido

On Tue, Mar 08, 2011 at 10:19:16PM +0100, Guido Günther wrote:
-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
On Tue, Mar 08, 2011 at 06:57:02PM +0000, Daniel P. Berrange wrote: [..snip..] 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@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 :|

On Wed, Mar 09, 2011 at 12:03:37PM +0000, Daniel P. Berrange wrote: [..snip..]
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.
Pushed now, thanks. -- Guido
participants (2)
-
Daniel P. Berrange
-
Guido Günther