Cross Compile QEMU from Ubuntu to Windows 10

For several days I have been stuck trying to cross compile QEMU for windows 10 x64. I am not familiar with minwg at all. I read a lot of pages but most of time it seems to be to old or or to not use this method. I have to cross-compile QEMU with a patch then I must follow the instructions.

I compiled for Ubuntu and it was easy, but for windows 10 x64 i have NO executable, I probably missed something.

I think my problem is relative to "prefix" but i'm not sure. I say that because the guy compiling for windows 10 wrote these instructions for Debian.

targets="i686-w64-mingw32 x86_64-w64-mingw32"
for target in $targets; do echo Building $target... mingw=/usr/$target/sys-root/mingw mkdir -p /qemu/bin/ndebug/$target cd /qemu/bin/ndebug/$target rm -r * ../../../configure --cross-prefix=$target- --disable-guest-agent-msi --disable-werror --extra-cflags="-I $mingw/include" --extra-ldflags="-L $mingw/lib" && make
done

In my case I have a problem with this instruction on the "--cross-prefix" part, because i have this in my "/usr/" folder

screenshot

I've already asked on forum where people talk the same language as me, but nobody could help me, at least with Ubuntu.

My environment:

sudo apt install mingw-w64
sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev
sudo apt-get install build-essential
sudo apt-get install git

What i tried, but I don't have the exe files

../../../configure --host=i686-w64-mingw32 --enable-debug
../../../configure --host=x86_64-w64-mingw32 --enable-debug

What i tried, but I get an errorScreenshot

Perhaps I don't have a part to compile for windows 10.


edit: I found a partial solution with help i received from teams:

I built only with MSYS2 mingw 64 all the time

PACMAN -S mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-python mingw-w64-x86_64-python-sphinx mingw-w64-x86_64-python-sphinx_rtd_theme mingw-w64-x86_64-autotools mingw-w64-x86_64-cc
Pacman -S mingw-w64-x86_64-capstone mingw-w64-x86_64-curl mingw-w64-x86_64-cyrus-sasl mingw-w64-x86_64-glib2 mingw-w64-x86_64-gnutls mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libjpeg mingw-w64-x86_64-libnfs mingw-w64-x86_64-libpng mingw-w64-x86_64-libslirp mingw-w64-x86_64-libssh mingw-w64-x86_64-libssp mingw-w64-x86_64-libtasn1 mingw-w64-x86_64-libusb mingw-w64-x86_64-libxml2 mingw-w64-x86_64-lzo2 mingw-w64-x86_64-nettle mingw-w64-x86_64-pixman mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-spice mingw-w64-x86_64-snappy mingw-w64-x86_64-usbredir mingw-w64-x86_64-zstd 

To have all packages, now you can follow instructions to compile on their wiki page, no need to run mingw, stay on msys2 mingw x64

When it's finished For those not familiars with MSYS2, you can run your exe with ./

It you want to launch them from explorer.

  • Make a special folder
  • Copy exe on this folder
  • Search /MSYS2/mingw64/bin (according to your install folder)
  • Copy all dll to your special folder (step 1)
  • Copy pc-bios folder from MSYS2/home//<clone path of QEMU/build to your special folder.

That's all.

Perhaps there is more thing to do to ameliorate but for the while i don't know more.

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like