qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Sameeh Jubran <sameeh@daynix.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu-ga static compilation
Date: Mon, 20 Mar 2017 13:57:08 +0000	[thread overview]
Message-ID: <20170320135708.GV17887@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAKPgXcFwSHgb+sLimF=+En_fHM1rYnV1+jX3Tg_hP07EmzyiJg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]

On Tue, Mar 14, 2017 at 06:51:37PM +0200, Sameeh Jubran wrote:
> I am trying to compile qemu-ga for Windows statically using the following
> commands:
> 
> ./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
> 
> 
> And I keep getting this error:
> 
> /home/sameeh/Builds/q/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
> 
> 
> Notes to consider:
> * without --static I can compile it successfully
> * Build machine is running Fedora 25
> * I have upgraded all of the tools to their latest version
> * If I comment out the function which is causing the issue
> (g_test_initialized()), qemu ga compiles statically and runs successfully
> without the need of any dlls.
> 
> Can anyone reproduce this? Do you have any idea why is this happening?

I guess GLIB_STATIC_COMPILATION is not defined in your build (see the
definition of GLIB_VAR in the glib headers).

The pkg-config file for glib doesn't define GLIB_STATIC_COMPILATION for
pkg-config --static.  I guess we must add it manually.

Does this work?

diff --git a/configure b/configure
index 99d8bec..10f23b7 100755
--- a/configure
+++ b/configure
@@ -3047,6 +3047,10 @@ if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-2.0"
 fi
 
+if test "$static" = 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)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  parent reply	other threads:[~2017-03-20 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 16:51 [Qemu-devel] qemu-ga static compilation Sameeh Jubran
2017-03-20 12:05 ` Sameeh Jubran
2017-03-20 12:12 ` Peter Maydell
2017-03-20 13:57 ` Stefan Hajnoczi [this message]
2017-03-20 14:04   ` Peter Maydell
2017-03-20 15:44   ` Sameeh Jubran
2017-03-21  9:23     ` Sameeh Jubran
2017-03-22 17:08       ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320135708.GV17887@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sameeh@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).