[PULL,09/52] build-sys: fix qemu-ga -pthread linking

Message ID 1515756676-3860-10-git-send-email-pbonzini@redhat.com
State New
Headers show
  • [PULL,01/52] scsi-generic: Add share-rw option
Related show

Commit Message

Paolo Bonzini Jan. 12, 2018, 11:30 a.m.
From: Marc-André Lureau <marcandre.lureau@redhat.com>

When linking qemu-ga under some configuration (when gthread-2.0.pc
doesn't have -pthread, as happening atm with meson build), you may
have this linking issue:

/usr/bin/ld: libqemuutil.a(qemu-thread-posix.o): undefined reference to symbol 'pthread_setname_np@@GLIBC_2.12'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line

Make sure qemu-ga links with the pthread library, by adding correct
flags to libs_qga.

This is really a QEMU bug, because it's QEMU code that's using pthread
functions, and so we must explicitly link against pthreads. The bug
was just masked by the fact that often some pkg-config or another for
one of our dependencies will add -pthread to the link line anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20180104160523.22995-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
 configure | 1 +
 1 file changed, 1 insertion(+)


diff --git a/configure b/configure
index 89bd662..ac392d2 100755
--- a/configure
+++ b/configure
@@ -3464,6 +3464,7 @@  else
       if test "$found" = "no"; then
         LIBS="$pthread_lib $LIBS"
+        libs_qga="$pthread_lib $libs_qga"