qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler
@ 2008-10-24 13:35 Richard W.M. Jones
  2008-10-24 13:58 ` Anthony Liguori
  2008-10-24 14:05 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2008-10-24 13:35 UTC (permalink / raw)
  To: qemu-devel

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

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

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/

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

[-- Attachment #2: qemu-mingw32-get-it-working.patch --]
[-- Type: text/plain, Size: 2338 bytes --]

Index: migration.c
===================================================================
--- migration.c	(revision 5521)
+++ migration.c	(working copy)
@@ -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 */
Index: vl.c
===================================================================
--- vl.c	(revision 5521)
+++ vl.c	(working copy)
@@ -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 */
Index: monitor.c
===================================================================
--- monitor.c	(revision 5521)
+++ monitor.c	(working copy)
@@ -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, },
 };
 
Index: migration-tcp.c
===================================================================
--- migration-tcp.c	(revision 5521)
+++ migration-tcp.c	(working copy)
@@ -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 */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler
  2008-10-24 13:35 [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler Richard W.M. Jones
@ 2008-10-24 13:58 ` Anthony Liguori
  2008-10-24 14:05 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2008-10-24 13:58 UTC (permalink / raw)
  To: qemu-devel

Richard W.M. Jones wrote:
> 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
>
> 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

> Rich.
>
> [1] http://fedoraproject.org/wiki/MinGW
> [2] http://www.annexia.org/tmp/mingw/fedora-9/
>
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler
  2008-10-24 13:35 [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler Richard W.M. Jones
  2008-10-24 13:58 ` Anthony Liguori
@ 2008-10-24 14:05 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2008-10-24 14:05 UTC (permalink / raw)
  To: qemu-devel

Richard W.M. Jones wrote:
> 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..

>   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.

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

>   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/
>
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-24 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 13:35 [Qemu-devel] [PATCH] Fix compilation on MinGW Windows cross-compiler Richard W.M. Jones
2008-10-24 13:58 ` Anthony Liguori
2008-10-24 14:05 ` Anthony Liguori

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).