Fix compilation on MinGW Windows cross-compiler
PATCH 1/1 Fix compilation on MinGW Windows cross-compiler
Inspired by some comments by Anthony Liguori yesterday, I got qemu to compile using the Fedora MinGW cross-compiler[1].
There are some problems introduced by what I think is new code (the migration code), so I just hacked those bits out. Not a good fix, but the patch is attached anyhow.
After installing the MinGW packages in Fedora[2], the command to compile qemu is:
PATH=/usr/i686-pc-mingw32/sys-root/mingw/bin:$PATH \
PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \
./configure \
--cross-prefix=i686-pc-mingw32- \
--host-cc=i686-pc-mingw32-gcc \
--cpu=i386 \
--disable-gcc-check \
--audio-drv-list=
makeThis produces Windows binaries (eg. qemu-system-x86_64.exe) which work to some extent under Wine. In fact I was able to boot a 64 bit Fedora 9 guest up to the point where it runs initrd, at which point qemu crashes somewhere.
I didn't test the binaries on real Windows.
Rich.
[1] http://fedoraproject.org/wiki/MinGW
[2] http://www.annexia.org/tmp/mingw/fedora-9/
Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
migration.c +3 -0
@@ -15,6 +15,8 @@#include "migration.h" #include "console.h" +#if !defined(WIN32 ) +/* Migration speed throttling */ static uint32_t max_throttle = (32 <<20 );
@@ -101,3 +103,4 @@ } } +#endif /* !WIN32 */
vl.c +4 -0
@@ -6213,6 +6213,7 @@return 18 ;/* len */ } +#if !defined(WIN32 )void qemu_announce_self (void ) {int i, j, len;
@@ -6230,6 +6231,7 @@ } } } +#endif /***********************************************************/ /* savevm/loadvm support */
@@ -9744,10 +9746,12 @@if (loadvm)do_loadvm (loadvm); +#if !defined(WIN32 )if (incoming) { autostart =0 ;/* fixme how to deal with -daemonize */ qemu_start_incoming_migration (incoming); } +#endif {/* XXX: simplify init */
monitor.c +4 -0
@@ -1455,12 +1455,14 @@ { "nmi", "i", do_inject_nmi, "cpu", "inject an NMI on the given CPU", }, #endif +#if !defined(WIN32) { "migrate", "-ds", do_migrate, "[-d] uri", "migrate to URI (using -d to not wait for completion)" }, { "migrate_cancel", "", do_migrate_cancel, "", "cancel the current VM migration" }, { "migrate_set_speed", "s", do_migrate_set_speed, "value", "set maximum speed (in bytes) for migrations" }, +#endif { NULL, NULL, }, };
@@ -1523,7 +1525,9 @@ { "slirp", "", do_info_slirp, "", "show SLIRP statistics", }, #endif +#if !defined(WIN32) { "migrate", "", do_info_migrate, "", "show migration status" }, +#endif { NULL, NULL, }, };
migration-tcp.c +4 -0
@@ -20,6 +20,8 @@#include "buffered_file.h" #include "block.h" +#if !defined(WIN32 ) +//#define DEBUG_MIGRATION_TCP typedef struct FdMigrationState
@@ -369,3 +371,5 @@close (s); return -errno; } + +#endif /* !WIN32 */
Quoted 20 lines · Richard W.M. Jones
Inspired by some comments by Anthony Liguori yesterday, I got qemu to compile using the Fedora MinGW cross-compiler[1].
There are some problems introduced by what I think is new code (the migration code), so I just hacked those bits out. Not a good fix, but the patch is attached anyhow.
After installing the MinGW packages in Fedora[2], the command to compile qemu is:
PATH=/usr/i686-pc-mingw32/sys-root/mingw/bin:$PATH \ PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ ./configure \ --cross-prefix=i686-pc-mingw32- \ --host-cc=i686-pc-mingw32-gcc \ --cpu=i386 \ --disable-gcc-check \ --audio-drv-list= make
Quoted 7 lines
This produces Windows binaries (eg. qemu-system-x86_64.exe) which work to some extent under Wine. In fact I was able to boot a 64 bit Fedora 9 guest up to the point where it runs initrd, at which point qemu crashes somewhere.
I didn't test the binaries on real Windows.
I've got a better fix locally that I'll commit. It doesn't get migration working on Windows but it at least compiles.
Regards,
Anthony Liguori
Quoted 6 lines
Rich.
[1] http://fedoraproject.org/wiki/MinGW
[2] http://www.annexia.org/tmp/mingw/fedora-9/
Quoted 10 lines · Richard W.M. Jones
Inspired by some comments by Anthony Liguori yesterday, I got qemu to compile using the Fedora MinGW cross-compiler[1].
There are some problems introduced by what I think is new code (the migration code), so I just hacked those bits out. Not a good fix, but the patch is attached anyhow.
After installing the MinGW packages in Fedora[2], the command to compile qemu is:
So in case anyone wants to do some configure hacking..
Quoted 6 lines
PATH=/usr/i686-pc-mingw32/sys-root/mingw/bin:$PATH \
PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \
./configure \
--cross-prefix=i686-pc-mingw32- \
--host-cc=i686-pc-mingw32-gcc \This is broken. We really should really use the host CC to build and run dyngen. However, dyngen is disappearing soon so it's probably not worth fixing.
Quoted 4 lines
--cpu=i386 \
--disable-gcc-check \
--audio-drv-list=The audio driver probing is busted. I usually use --audio-drv-list="sdl" FWIW but this shouldn't be necessary. Right now, the audio driver code looks at the host platform and tries to guess the available audio drivers. It would be better to just compile probe all of them.
Regards,
Anthony Liguori
Quoted 15 lines
make
This produces Windows binaries (eg. qemu-system-x86_64.exe) which work to some extent under Wine. In fact I was able to boot a 64 bit Fedora 9 guest up to the point where it runs initrd, at which point qemu crashes somewhere.
I didn't test the binaries on real Windows.
Rich.
[1] http://fedoraproject.org/wiki/MinGW
[2] http://www.annexia.org/tmp/mingw/fedora-9/