Received: from eggs.gnu.org ([2001:4830:134:3::10]:39890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cs4uV-0007Mr-SR for qemu-devel@nongnu.org; Sun, 26 Mar 2017 05:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cs4uS-0002xn-PL for qemu-devel@nongnu.org; Sun, 26 Mar 2017 05:56:31 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34417) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cs4uS-0002xb-J0 for qemu-devel@nongnu.org; Sun, 26 Mar 2017 05:56:28 -0400 Received: by mail-wr0-x243.google.com with SMTP id w43so1432092wrb.1 for ; Sun, 26 Mar 2017 02:56:28 -0700 (PDT) From: Sameeh Jubran Date: Sun, 26 Mar 2017 12:56:22 +0300 Message-Id: <20170326095622.5105-1-sameeh@daynix.com> Subject: [Qemu-devel] [PATCH qemu-ga v3] qga: Make qemu-ga compile statically for Windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Michael Roth Cc: Yan Vugenfirer , Stefan Hajnoczi , Peter Maydell Attempting to compile qemu-ga statically as follows for Windows causes the following error: Compilation: ./configure --disable-docs --target-list=x86_64-softmmu \ --cross-prefix=x86_64-w64-mingw32- --static \ --enable-guest-agent-msi --with-vss-sdk=/path/to/VSSSDK72 make -j8 qemu-ga Error: path/to/qemu/stubs/error-printf.c:7: undefined reference to `__imp_g_test_config_vars' collect2: error: ld returned 1 exit status Makefile:444: recipe for target 'qemu-ga.exe' failed make: *** [qemu-ga.exe] Error 1 This is caused by a bug in the pkg-config file for glib as it doesn't define GLIB_STATIC_COMPILATION for pkg-config --static. Signed-off-by: Sameeh Jubran Reviewed-by: Stefan Hajnoczi --- configure | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure b/configure index b9a30cf..8210494 100755 --- a/configure +++ b/configure @@ -3041,6 +3041,13 @@ if test "$modules" = yes; then glib_modules="$glib_modules gmodule-2.0" fi +# This workaround is required due to a bug in pkg-config file for glib as it +# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static + +if test "$static" = yes -a "$mingw32" = yes; then + QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" +fi + for i in $glib_modules; do if $pkg_config --atleast-version=$glib_req_ver $i; then glib_cflags=$($pkg_config --cflags $i) -- 2.9.3