On 7 April 2015 at 23:45, Liviu Ionescu <i...@livius.net> wrote: >> On 08 Apr 2015, at 01:36, Peter Maydell <peter.mayd...@linaro.org> wrote: >> >> No, I built an actual 64 bit Windows binary and it worked. > > ok, then it must be only a matter of configure, which does not > detect running on mingw-w64 to set the required options > (perhaps like -mthreads -D_POSIX=1), and I need to set them > manually.
I didn't need to set any odd configure options. I dug out my notes on my setup at the time. There's stuff here about setting up the 32-bit toolchain as well as the 64-bit one which I haven't bothered to edit out; ignore the bits you don't care about. I haven't checked if all the zipfile links are still valid; but at the time (about June last year) this was a reproducible recipe that other people were able to use to build working w64 binaries. My top two guesses for your situation would be: (1) did you install the right libpthreads compile time package on the build host, and copy its runtime dlls across to the windows box? (2) did you make sure that if the windows box had any mingw install on it already that those directories were removed from the %PATH% to ensure that Windows didn't try to load bogus DLLs from them? Notes below: ===begin=== My build machine was Ubuntu Raring. The Windows machine I tested on ran Windows 7. You need the following packages on your build host: binutils-mingw-w64 gcc-mingw-w64 libpthreads-mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev (in addition to all the usual things you'd need for native QEMU builds). These install cross tools from the 'mingw-w64' project for i686 and x86-64 targets. Don't get confused and install any 'mingw32' tools: that is a separate project, and at least in Ubuntu the compiler is very old and doesn't support thread local storage, so trying to use it results in a QEMU that crashes at startup. You'll also need to get hold of the glib dev packages from http://www.gtk.org/download/win32.php http://www.gtk.org/download/win64.php (the ones in the 'gtk+ 3.x' section of the page) Specifically for win32 you need http://win32builder.gnome.org/packages/3.6/gettext-dev_0.18.2.1-1_win32.zip http://win32builder.gnome.org/packages/3.6/libpng-dev_1.5.14-1_win32.zip http://win32builder.gnome.org/packages/3.6/zlib-dev_1.2.7-1_win32.zip http://win32builder.gnome.org/packages/3.6/glib-dev_2.34.3-1_win32.zip http://win32builder.gnome.org/packages/3.6/pixman-dev_0.26.0-1_win32.zip and for win64 you need: http://win32builder.gnome.org/packages/3.6/gettext-dev_0.18.2.1-1_win64.zip http://win32builder.gnome.org/packages/3.6/libpng-dev_1.5.14-1_win64.zip http://win32builder.gnome.org/packages/3.6/zlib-dev_1.2.7-1_win64.zip http://win32builder.gnome.org/packages/3.6/glib-dev_2.34.3-1_win64.zip http://win32builder.gnome.org/packages/3.6/pixman-dev_0.26.0-1_win64.zip Create directories ~/my-mingw and ~/my-mingw64, and extract the zipfiles into them (so you should end up with a ~/my-mingw/lib, and a ~/my-mingw64/lib, and some other dirs). Create the pkg-config scripts for the two toolchains: /usr/local/bin/i686-w64-mingw32-pkg-config ===begin=== #!/bin/sh prefix=/full/path/to/my-mingw PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig export PKG_CONFIG_LIBDIR exec pkg-config --define-variable=prefix=$prefix $@ ===endit=== /usr/local/bin/x86_64-w64-mingw32-pkg-config ===begin=== #!/bin/sh prefix=/full/path/to/my-mingw64 PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig export PKG_CONFIG_LIBDIR exec pkg-config --define-variable=prefix=$prefix $@ ===endit=== Adjust the prefix= setting appropriately in each case. Now you can do a build. Adjust the paths to the mingw and mingw64 directories to suit. mkdir build/w32-arm (cd build/w32-arm && ../../configure --cross-prefix=i686-w64-mingw32- '--extra-cflags=-I/path/to/my-mingw/include' '--extra-ldflags=-L/path/to/my-mingw/lib' '--target-list=aarch64-softmmu,arm-softmmu') && make -C build/w32-arm -j4 mkdir build/w64-arm (cd build/w64-arm && ../../configure --cross-prefix=x86_64-w64-mingw32- '--extra-cflags=-I/path/to/my-mingw64/include' '--extra-ldflags=-L/path/to/my-mingw64/lib' '--target-list=aarch64-softmmu,arm-softmmu') && make -C build/w64-arm -j4 That should give you .exe files in the usual places: build/w32-arm/aarch64-softmmu/qemu-system-aarch64.exe build/w64-arm/aarch64-softmmu/qemu-system-aarch64.exe Next up we need to copy those over to a Windows box, together with all the DLLs needed at runtime. Create directories on the Windows box, say winqemu\ and w64qemu\, and copy the corresponding exes into them. Copy across from the source tree the pc-bios/keymaps/ tree, so that it ends up as winqemu\keymaps\ and w64qemu\keymaps\. 1. MinGW runtime DLLs: For winqemu: /usr/lib/gcc/i686-w64-mingw32/4.6/*.dll /usr/i686-w64-mingw32/lib/*.dll For w64qemu: /usr/lib/gcc/x86_64-w64-mingw32/4.6/*.dll /usr/x86_64-w64-mingw32/lib/*.dll 2. glib etc runtime DLLs: Grab the 'runtime' zip files corresponding to the dev packages above. You also need the libiconv runtime: http://win32builder.gnome.org/packages/3.6/glib_2.34.3-1_win64.zip http://win32builder.gnome.org/packages/3.6/zlib_1.2.7-1_win64.zip http://win32builder.gnome.org/packages/3.6/pixman_0.26.0-1_win64.zip http://win32builder.gnome.org/packages/3.6/libpng_1.5.14-1_win64.zip http://win32builder.gnome.org/packages/3.6/gettext_0.18.2.1-1_win64.zip http://win32builder.gnome.org/packages/3.6/libiconv_1.13.1-1_win64.zip Note that these zipfiles tend to have a bunch of runtime files and a variety of directory structures inside them. All you want is to grab all the .dll files and extract those to the top level winqemu\ or w64qemu\ directories. Similarly for win32. If you happen to have a local mingw installation it's probably a good idea to make sure it is *not* on your PATH, otherwise Windows will try to fish DLLs out of there. ===endit=== -- PMM