Skip to contentSkip to conversation

qga: Make qemu-ga compile statically for Windows

PATCH Superseded Sameeh Jubran 3 participants 5 messages Mar 22, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index b9a30cf..6f7b460 100755
@@ -4138,7 +4138,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS $vss_win32_include"
     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
     qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
   else
Signature · 1 line
2.9.3
#1 lore raw
Quoted 22 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

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 int main(void) { return VSS_CTX_BACKUP; } · line 4144

Quoted 8 lines
configure +1 -1
@@ -4138,7 +4138,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS $vss_win32_include"
     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
     qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
   else

If we need this for static glib compilation we should be adding it where we do the "test for glib and add glib related flags to the CFLAGS", not in the part of configure where we decide that we're compiling the guest agent.

Also, please can we have a comment that clearly states why we need this and that we're working around a packaging bug in glib for Windows, please?

thanks
-- PMM

#2 lore raw
Quoted 43 lines · Peter Maydell
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

configure int main(void) { return VSS_CTX_BACKUP; } · line 4141

Quoted 10 lines

GLIB_STATIC_COMPILATION for pkg-config --static.

configure +1 -1
@@ -4138,7 +4138,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS

$vss_win32_include"

Review int main(void) { return VSS_CTX_BACKUP; } · line 4142

Quoted 1 line
(quoted diff) +0 -0
     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++

-Wl,--enable-stdcall-fixup $libs_qga"

Review int main(void) { return VSS_CTX_BACKUP; } · line 4143

Quoted 1 line
(quoted diff) +0 -0
     qga_vss_provider="qga/vss-win32/qga-vss.dll

qga/vss-win32/qga-vss.tlb"

Review int main(void) { return VSS_CTX_BACKUP; } · line 4144

Quoted 1 line
(quoted diff) +0 -0
   else

If we need this for static glib compilation we should be adding it where we do the "test for glib and add glib related flags to the CFLAGS", not in the part of configure where we decide that we're compiling the guest agent.

Quoted 4 lines

Also, please can we have a comment that clearly states why we need this and that we're working around a packaging bug in glib for Windows, please?

sure, no problem.

Quoted 4 lines

thanks
-- PMM

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

Hi

Quoted 10 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
Quoted 7 lines

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

weird, I don't get this error on fedora 25 (but I have no vss-sdk, is that related?).

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.

If that's a bug in glib, it would be nice to have a link to a bug report.

Quoted 4 lines

---

Quoted 17 lines
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index b9a30cf..6f7b460 100755
@@ -4138,7 +4138,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS

$vss_win32_include"

     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++
-Wl,--enable-stdcall-fixup $libs_qga"
     qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
Quoted 6 lines

else
--
2.9.3

--

Marc-André Lureau

#4 lore raw
Quoted 22 lines · Marc-André Lureau

Hi

Quoted 10 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
Quoted 7 lines

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 3 lines

weird, I don't get this error on fedora 25 (but I have no vss-sdk, is that related?).

Can you please try it with vss-sdk (
https://www.microsoft.com/en-us/download/details.aspx?id=23490)

Quoted 10 lines
Quoted 7 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.

If that's a bug in glib, it would be nice to have a link to a bug report.

I've just filed a bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=780399
<https://bugzilla.gnome.org/show_bug.cgi?id=780399>

Quoted 33 lines
Quoted 6 lines

---

Quoted 17 lines
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index b9a30cf..6f7b460 100755
@@ -4138,7 +4138,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS

$vss_win32_include"

     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++
-Wl,--enable-stdcall-fixup $libs_qga"
     qga_vss_provider="qga/vss-win32/qga-vss.dll
Quoted 7 lines

qga/vss-win32/qga-vss.tlb"
else
--
2.9.3

--

Marc-André Lureau

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