Skip to contentSkip to conversation

qga: Make qemu-ga compile statically for Windows

PATCH Superseded Sameeh Jubran 2 participants 3 messages Mar 23, 2017 – Mar 26, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qga: Make qemu-ga compile statically for Windows

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.

---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)
configure +7 -0
index b9a30cf..8210494 100755
@@ -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)
Signature · 1 line
2.9.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 16 lines · Sameeh Jubran

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

Quoted 5 lines

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.

Please remove this. I didn't post my Signed-off-by. Only add Signed-off-by for someone else if they ask you to do so.

For details on Signed-off-by please read:
"11) Sign your work - the Developer's Certificate of Origin"
https://www.kernel.org/doc/Documentation/process/submitting-patches.rst

Quoted 10 lines
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)
configure +0 -0
index b9a30cf..8210494 100755

configure if test "$modules" = yes; then · line 3045

Quoted 5 lines
configure +2 -0
@@ -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

Please add:

# See https://bugzilla.gnome.org/show_bug.cgi?id=780399 for the glib bug

# report.
#2 lore raw
Quoted 23 lines · Stefan Hajnoczi
Quoted 4 lines · Sameeh Jubran

Attempting to compile qemu-ga statically as follows for Windows causes the following error:

Compilation:

Quoted 8 lines
    ./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'

Quoted 5 lines

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

Quoted 3 lines

GLIB_STATIC_COMPILATION for pkg-config --static.

Quoted 8 lines
Quoted 1 line

Please remove this. I didn't post my Signed-off-by. Only add Signed-off-by for someone else if they ask you to do so.

For details on Signed-off-by please read:
"11) Sign your work - the Developer's Certificate of Origin"
https://www.kernel.org/doc/Documentation/process/submitting-patches.rst

I added your signed off to indicate that you were involved in the
development of the patch as you are the one that suggested this workaround in the first place. No problem I will drop it.

Quoted 19 lines
Quoted 12 lines
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)
configure +0 -0
index b9a30cf..8210494 100755

configure if test "$modules" = yes; then · line 3044

Quoted 4 lines
configure +1 -0
@@ -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

configure if test "$modules" = yes; then · line 3045

Quoted 1 line
configure +1 -0
+# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
Quoted 8 lines

Please add:

# See https://bugzilla.gnome.org/show_bug.cgi?id=780399 for the glib bug

# report.

I'll add them in v3, thanks for the review.

Signature · 4 lines
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*