]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
compile: fix undefined reference to gnutls_x509_crt_get_dn with gcc-4.6.1
authorXu He Jie <xuhj@linux.vnet.ibm.com>
Tue, 18 Oct 2011 08:06:44 +0000 (08:06 +0000)
committerEric Blake <eblake@redhat.com>
Wed, 19 Oct 2011 13:00:13 +0000 (07:00 -0600)
When I compile libvirt with gcc-4.6.1 in ubuntu 11.10, got error as below:

  CCLD   libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_migration.o): undefined reference to symbol 'gnutls_x509_crt_get_dn@@GNUTLS_1_4'
/usr/bin/ld: note: 'gnutls_x509_crt_get_dn@@GNUTLS_1_4' is defined in DSO /usr/lib/x86_64-linux-gnu/libgnutls.so so try adding it to the linker command line
/usr/lib/x86_64-linux-gnu/libgnutls.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [libvirtd] Error 1

It can compile with gcc-4.5.2 in ubuntu 11.04, but it can not compile with gcc-4.6.1 in ubuntu 11.10.

I didn't find reason. Does Anyone know the reason or the different between gcc-4.5.2 and gcc-4.6.1?

I still provide a patch for this. Just make it is working now.

Signed-off-by: soulxu <soulxu@soulxu-ThinkPad-T410.(none)>
src/Makefile.am

index 07f27d2522911e8788cd3582f3214003b85fb82c..2555f81d0177eaf348379535c62e796890c6df29 100644 (file)
@@ -776,10 +776,14 @@ noinst_LTLIBRARIES += libvirt_driver_qemu.la
 #libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la
 endif
 libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
+                                $(GNUTLS_CFLAGS) \
+                                $(LIBXML_CFLAGS) \
                -I@top_srcdir@/src/conf $(AM_CFLAGS)
 libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS)
 libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS) \
-                               $(CAPNG_LIBS)
+                               $(CAPNG_LIBS) \
+                                $(GNUTLS_LIBS) \
+                                $(LIBXML_LIBS)
 if WITH_DRIVER_MODULES
 libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version