How to Cross Build Latest Stable Qemu with x86_64-w64-mingw32

Installed the mingw and cloned the "latest stable" branch of QEMU with

sudo apt-get install -y mingw-w64
cd ~/
git clone -b stable-2.2 git://git.qemu.org/qemu.git
cd ~/qemu

Then from @http://wiki.qemu.org/Hosts/W32#Building_QEMU_for_W64 I tried:

./configure --cross-prefix=amd64-mingw32msvc-

and now I'm getting:

ERROR: "amd64-mingw32msvc-gcc" either does not exist or does not work

Update:

~/Scripts/qemu$ ./configure --cross-prefix=x86_64-w64-mingw32-
ERROR: pkg-config binary 'x86_64-w64-mingw32-pkg-config' not found

2nd Update:

Fixed previous issue with

sudo link /usr/bin/pkg-config /usr/bin/x86_64-w64-mingw32-pkg-config
sudo apt-get --no-install-recommends -y build-dep qemu

but now I'm getting:

owner@K53TA:~/qemu$ ./configure --cross-prefix=x86_64-w64-mingw32-

ERROR: zlib check failed
       Make sure to have the zlib libs and headers installed.

but zlib1g-dev IS INSTALLED


Warning: This answer is a Work In Progress

Even though I asked the OP to consider using WinQemu, I'm officially writing an answer for those that choose to "do it from scratch." Assuming your build host is 64-bit and your Windows is 32-bit:

  1. We need to remove the OP's failed install of the cross-compile tools, using:
    sudo apt-get --purge remove mingw-w64
    rm -vR ~/qemu
  2. Now we must decide on our Architecture. If your Build host is 64-bit, and your Windows is 32-bit, use:
    sudo apt-get install gcc-mingw32 mingw32-binutils mingw32-runtime
  3. If your Build host is 64-bit, and your Windows is 64-bit, use:
    sudo apt-get install gcc-mingw32 mingw32-binutils mingw-w64
  4. Optional: Add SDL Support by:
    wget http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz
  5. Now we download the Source Tarball, and untar it. You can also use the Git Clone as the OP did, but you only need to choose one option: sudo apt-get install wget && wget http://wiki.qemu-project.org/download/qemu-2.2.0.tar.bz2 && tar -xvjpf qemu-2.2.0.tar.bz2 && cd qemu-2.2.0
  6. Now we configure the build. If your Build host is 64-bit, and your Windows is 32-bit, use: configure --cross-prefix=i586-mingw32msvc- [--extra-cflags=-mthreads]
  7. If your Build host is 64-bit, and your Windows is 64-bit, use: configure --cross-prefix=amd64-mingw32msvc-

Note: If the Configure Phase fails, you must fix the configure errors, as the OP alluded to. At this point, a configure failure is most likely caused by missing libraries