Re: [PATCH v2] make sure libvirt is linked first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 05, 2018 at 04:19:50PM +0100, Jan Palus wrote:
> so it's not affected by flags that might be passed in $(*_LIBS) like
> -L/usr/lib which might result in linking against system library and
> requiring incorrect version of private symbols
> 
> Signed-off-by: Jan Palus <atler@xxxxxxxxxxxxx>
> ---
>  src/Makefile.am         | 42 ++++++++++++++++++++++--------------------
>  src/lxc/Makefile.inc.am |  2 +-
>  tools/Makefile.am       |  2 +-
>  3 files changed, 24 insertions(+), 22 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 3bf2da5..3c83513 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1153,6 +1153,11 @@ libvirtd_LDFLAGS = \
>  	$(NULL)
>  
>  libvirtd_LDADD = \
> +	libvirt_driver_admin.la \
> +	libvirt-lxc.la \
> +	libvirt-qemu.la \
> +	libvirt.la \
> +	../gnulib/lib/libgnu.la $(LIBSOCKET) \

We need to leave  libgnu.la $(LIBSOCKET) where it was originally,
likewise for the other places where you moved libgnu.la.  There's
no problem with libgnu.a clashing with stuff in /usr/lib, since
libgnu never gets installed - its always static linked into apps
locally, and must always come last in the linker args.

>  	$(LIBXML_LIBS) \
>  	$(GNUTLS_LIBS) \
>  	$(SASL_LIBS) \
> @@ -1164,14 +1169,6 @@ if WITH_DTRACE_PROBES
>  libvirtd_LDADD += ../src/libvirt_probes.lo
>  endif WITH_DTRACE_PROBES
>  
> -libvirtd_LDADD += \
> -	libvirt_driver_admin.la \
> -	libvirt-lxc.la \
> -	libvirt-qemu.la \
> -	libvirt.la \
> -	../gnulib/lib/libgnu.la $(LIBSOCKET) \
> -	$(NULL)
> -
>  endif WITH_LIBVIRTD
>  EXTRA_DIST += \
>  	remote/test_libvirtd.aug.in \
> @@ -1222,7 +1219,7 @@ libvirt_driver_interface_la_CFLAGS = \
>  		-I$(srcdir)/conf \
>  		$(AM_CFLAGS) $(LIBNL_CFLAGS)
>  libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
> -libvirt_driver_interface_la_LIBADD =
> +libvirt_driver_interface_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
>  if WITH_NETCF
>  libvirt_driver_interface_la_CFLAGS += $(NETCF_CFLAGS)
>  libvirt_driver_interface_la_LIBADD += $(NETCF_LIBS)
> @@ -1231,7 +1228,6 @@ if WITH_UDEV
>  libvirt_driver_interface_la_CFLAGS += $(UDEV_CFLAGS)
>  libvirt_driver_interface_la_LIBADD += $(UDEV_LIBS)
>  endif WITH_UDEV
> -libvirt_driver_interface_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
>  libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES)
>  endif WITH_INTERFACE
>  
> @@ -1323,7 +1319,6 @@ endif WITH_STORAGE_SCSI
>  if WITH_STORAGE_MPATH
>  libvirt_storage_backend_mpath_la_SOURCES = \
>  	$(STORAGE_DRIVER_MPATH_SOURCES)
> -libvirt_storage_backend_mpath_la_LIBADD = $(DEVMAPPER_LIBS)
>  libvirt_storage_backend_mpath_la_CFLAGS = \
>  	-I$(srcdir)/conf \
>  	$(DEVMAPPER_CFLAGS) \
> @@ -1331,7 +1326,10 @@ libvirt_storage_backend_mpath_la_CFLAGS = \
>  
>  storagebackend_LTLIBRARIES += libvirt_storage_backend_mpath.la
>  libvirt_storage_backend_mpath_la_LDFLAGS = $(AM_LDFLAGS_MOD)
> -libvirt_storage_backend_mpath_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
> +libvirt_storage_backend_mpath_la_LIBADD = \
> +	libvirt.la \
> +	../gnulib/lib/libgnu.la \
> +	$(DEVMAPPER_LIBS)
>  endif WITH_STORAGE_MPATH
>  
>  if WITH_STORAGE_DISK
> @@ -1347,7 +1345,6 @@ endif WITH_STORAGE_DISK
>  
>  if WITH_STORAGE_RBD
>  libvirt_storage_backend_rbd_la_SOURCES = $(STORAGE_DRIVER_RBD_SOURCES)
> -libvirt_storage_backend_rbd_la_LIBADD = $(LIBRBD_LIBS)
>  libvirt_storage_backend_rbd_la_CFLAGS = \
>  	-I$(srcdir)/conf \
>  	-I$(srcdir)/secret \
> @@ -1355,7 +1352,10 @@ libvirt_storage_backend_rbd_la_CFLAGS = \
>  
>  storagebackend_LTLIBRARIES += libvirt_storage_backend_rbd.la
>  libvirt_storage_backend_rbd_la_LDFLAGS = $(AM_LDFLAGS_MOD)
> -libvirt_storage_backend_rbd_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
> +libvirt_storage_backend_rbd_la_LIBADD = \
> +	libvirt.la \
> +	../gnulib/lib/libgnu.la \
> +	$(LIBRBD_LIBS)
>  endif WITH_STORAGE_RBD
>  
>  if WITH_STORAGE_SHEEPDOG
> @@ -1380,7 +1380,6 @@ endif WITH_STORAGE_SHEEPDOG
>  if WITH_STORAGE_GLUSTER
>  libvirt_storage_backend_gluster_la_SOURCES = \
>  	$(STORAGE_DRIVER_GLUSTER_SOURCES)
> -libvirt_storage_backend_gluster_la_LIBADD = $(GLUSTERFS_LIBS)
>  libvirt_storage_backend_gluster_la_CFLAGS = \
>  	-I$(srcdir)/conf \
>  	$(GLUSTERFS_CFLAGS) \
> @@ -1388,7 +1387,10 @@ libvirt_storage_backend_gluster_la_CFLAGS = \
>  
>  storagebackend_LTLIBRARIES += libvirt_storage_backend_gluster.la
>  libvirt_storage_backend_gluster_la_LDFLAGS = $(AM_LDFLAGS_MOD)
> -libvirt_storage_backend_gluster_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
> +libvirt_storage_backend_gluster_la_LIBADD = \
> +	libvirt.la \
> +	../gnulib/lib/libgnu.la \
> +	$(GLUSTERFS_LIBS)
>  endif WITH_STORAGE_GLUSTER
>  
>  if WITH_STORAGE_ZFS
> @@ -1424,7 +1426,7 @@ libvirt_driver_nodedev_la_CFLAGS = \
>  		-I$(srcdir)/conf \
>  		$(AM_CFLAGS) $(LIBNL_CFLAGS)
>  libvirt_driver_nodedev_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
> -libvirt_driver_nodedev_la_LIBADD =
> +libvirt_driver_nodedev_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
>  
>  if WITH_HAL
>  libvirt_driver_nodedev_la_SOURCES += $(NODE_DEVICE_DRIVER_HAL_SOURCES)
> @@ -1437,7 +1439,6 @@ libvirt_driver_nodedev_la_CFLAGS += $(UDEV_CFLAGS) $(PCIACCESS_CFLAGS)
>  libvirt_driver_nodedev_la_LIBADD += $(UDEV_LIBS) $(PCIACCESS_LIBS)
>  endif WITH_UDEV
>  
> -libvirt_driver_nodedev_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
>  endif WITH_NODE_DEVICES
>  
>  
> @@ -1456,10 +1457,11 @@ libvirt_driver_nwfilter_impl_la_CFLAGS = \
>  		$(AM_CFLAGS)
>  libvirt_driver_nwfilter_impl_la_LDFLAGS = $(AM_LDFLAGS)
>  libvirt_driver_nwfilter_impl_la_LIBADD = \
> +		libvirt.la \
>  		$(LIBPCAP_LIBS) \
>  		$(LIBNL_LIBS) \
> -		$(DBUS_LIBS)
> -libvirt_driver_nwfilter_impl_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
> +		$(DBUS_LIBS) \
> +		../gnulib/lib/libgnu.la
>  libvirt_driver_nwfilter_impl_la_SOURCES = $(NWFILTER_DRIVER_SOURCES)
>  endif WITH_NWFILTER
>  
> diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am
> index 8a3d4c4..8dd2e9e 100644
> --- a/src/lxc/Makefile.inc.am
> +++ b/src/lxc/Makefile.inc.am
> @@ -121,8 +121,8 @@ libvirt_lxc_LDFLAGS = \
>  	$(LIBXML_LIBS) \
>  	$(NULL)
>  libvirt_lxc_LDADD = \
> -	$(FUSE_LIBS) \
>  	libvirt.la \
> +	$(FUSE_LIBS) \
>  	../gnulib/lib/libgnu.la \
>  	$(NULL)
>  if WITH_DTRACE_PROBES
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 85e640b..1452d98 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -139,9 +139,9 @@ libvirt_shell_la_LDFLAGS = \
>  		$(COVERAGE_LDFLAGS) \
>  		$(NULL)
>  libvirt_shell_la_LIBADD = \
> +		../src/libvirt.la \
>  		$(LIBXML_LIBS) \
>  		$(READLINE_LIBS) \
> -		../src/libvirt.la \
>  		../gnulib/lib/libgnu.la \
>  		$(NULL)
>  libvirt_shell_la_SOURCES = vsh.c vsh.h
> -- 
> 2.16.2
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux