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

Re: [libvirt] [PATCH v2] Link libxml2 and libdbus in tests which need it.



Quoting Daniel P. Berrange (berrange redhat com):
> On Mon, Apr 08, 2013 at 07:54:55AM -0500, Serge Hallyn wrote:
> > Some tests fail to build without libxml2 or libdbus specified, add
> > them where needed.
> > 
> > Without this, I get errors like
> > 
> > /usr/bin/ld: virnettlscontexttest.o: undefined reference to symbol 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4'
> > /usr/bin/ld: note: 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4' is defined in DSO /usr/lib/x86_64-linux-gnu/libgnutls.so.26 so try adding it to the linker command line
> > /usr/lib/x86_64-linux-gnu/libgnutls.so.26: could not read symbols: Invalid operation
> > collect2: error: ld returned 1 exit status
> 
> So this makes sense because virnettlscontexttest.c directly
> calls various TLS APIs, and so needs to link to gnutls.
> 
> I'm not seeing why you need to add dbus + libxml to all these
> other tests though. What errors are you getting from them ?

I incrementally added them one by one, as I got DSO errors about libxml2
and dbus as below, in sequence:

CCLD   qemuxml2argvtest
/usr/bin/ld: ../src/.libs/libvirt_driver_qemu_impl.a(libvirt_driver_qemu_impl_la-qemu_domain.o): undefined reference to symbol 'xmlXPathRegisterNs@@LIBXML2_2.4.30'
/usr/bin/ld: note: 'xmlXPathRegisterNs@@LIBXML2_2.4.30' is defined in DSO /usr/lib/x86_64-linux-gnu/libxml2.so.2 so try adding it to the linker command line
/usr/lib/x86_64-linux-gnu/libxml2.so.2: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

[ and ]

/usr/bin/ld: ../src/.libs/libvirt_driver_network_impl.a(libvirt_driver_network_impl_la-bridge_driver.o): undefined reference to symbol 'dbus_bus_add_match'
/usr/bin/ld: note: 'dbus_bus_add_match' is defined in DSO /lib/x86_64-linux-gnu/libdbus-1.so.3 so try adding it to the linker command line
/lib/x86_64-linux-gnu/libdbus-1.so.3: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Looking back now at the patch, I see that the virnettlscontexttest hunk
is bad - it shouldn't be under the ifdefs.  New patch below:

>From 07d4ce365c19727d450729a51e868ebbe5d6231a Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge hallyn ubuntu com>
Date: Mon, 8 Apr 2013 12:52:05 +0000
Subject: [PATCH 1/1] Link libxml2 and libdbus in tests which need it (v3)

Some tests fail to build without libxml2 or libdbus specified, add
them where needed.

Without this, I get errors like

/usr/bin/ld: virnettlscontexttest.o: undefined reference to symbol 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4'
/usr/bin/ld: note: 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4' is defined in DSO /usr/lib/x86_64-linux-gnu/libgnutls.so.26 so try adding it to the linker command line
/usr/lib/x86_64-linux-gnu/libgnutls.so.26: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Changelog:  move the virnettlscontexttest GNUTLS_LIBS include out of
tasn1 ifdef.

Signed-off-by: Serge Hallyn <serge hallyn ubuntu com>
---
 tests/Makefile.am | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3abd698..4b5cf6d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -351,40 +351,40 @@ qemu_LDADDS += $(LDADDS)
 qemuxml2argvtest_SOURCES = \
 	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuxml2argvtest_LDADD = $(qemu_LDADDS)
+qemuxml2argvtest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemuxml2xmltest_SOURCES = \
 	qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuxml2xmltest_LDADD = $(qemu_LDADDS)
+qemuxml2xmltest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemuxmlnstest_SOURCES = \
 	qemuxmlnstest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuxmlnstest_LDADD = $(qemu_LDADDS)
+qemuxmlnstest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemuargv2xmltest_SOURCES = \
 	qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuargv2xmltest_LDADD = $(qemu_LDADDS)
+qemuargv2xmltest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemuhelptest_SOURCES = qemuhelptest.c testutils.c testutils.h
-qemuhelptest_LDADD = $(qemu_LDADDS)
+qemuhelptest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemumonitortest_SOURCES = qemumonitortest.c testutils.c testutils.h
-qemumonitortest_LDADD = $(qemu_LDADDS)
+qemumonitortest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 
 qemumonitorjsontest_SOURCES = \
 	qemumonitorjsontest.c \
 	testutils.c testutils.h \
 	testutilsqemu.c testutilsqemu.h \
 	$(NULL)
-qemumonitorjsontest_LDADD = $(qemu_LDADDS) libqemumonitortestutils.la
+qemumonitorjsontest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS) libqemumonitortestutils.la
 
 domainsnapshotxml2xmltest_SOURCES = \
 	domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS)
+domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LIBXML_LIBS) $(DBUS_LIBS)
 else
 EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
 	qemuxmlnstest.c qemuhelptest.c domainsnapshotxml2xmltest.c \
@@ -451,7 +451,7 @@ if WITH_NETWORK
 networkxml2conftest_SOURCES = \
 	networkxml2conftest.c \
 	testutils.c testutils.h
-networkxml2conftest_LDADD = ../src/libvirt_driver_network_impl.la $(LDADDS)
+networkxml2conftest_LDADD = ../src/libvirt_driver_network_impl.la $(LDADDS) $(XML_LIBS) $(DBUS_LIBS)
 else
 EXTRA_DIST += networkxml2conftest.c
 endif
@@ -500,7 +500,7 @@ interfacexml2xmltest_LDADD = $(LDADDS)
 cputest_SOURCES = \
 	cputest.c \
 	testutils.c testutils.h
-cputest_LDADD = $(LDADDS)
+cputest_LDADD = $(LDADDS) $(LIBXML_LIBS)
 
 virshtest_SOURCES = \
 	virshtest.c \
@@ -545,7 +545,7 @@ virnetsockettest_LDADD = $(LDADDS)
 if WITH_GNUTLS
 virnettlscontexttest_SOURCES = \
 	virnettlscontexttest.c testutils.h testutils.c
-virnettlscontexttest_LDADD = $(LDADDS)
+virnettlscontexttest_LDADD = $(LDADDS) $(GNUTLS_LIBS)
 if HAVE_LIBTASN1
 virnettlscontexttest_SOURCES += pkix_asn1_tab.c
 virnettlscontexttest_LDADD += -ltasn1
-- 
1.8.1.2


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