Compilation overview
When using an operating system (Windows, Linux, or Mac OS X), not only can we compile programs that run on the system, but we can also compile programs that run to other platforms (such as compiling programs on Linux that run on Windows, IOS, Android, and so on). The latter is called Cross-compilation (cross-compile) technology.
In general, compiling a program requires the following three types of resources to be provided first
1). Compiler
2). library or header file to which the target program depends
3). Target Program Source code
Currently the most widely used compiler even GCC, GCC is a cross-platform compiler family that supports multiple target systems, including a set of compilers. GCC, which compiles Windows programs, is called MinGW.
Cross-compiling Windows edition QEMU1 on Ubuntu. Installing the compiler
Although the official Ubuntu warehouse provides packages such as MINGW32 but does not provide important packages such as mingw32-zlib, according to reference [2], compiling QEMU also requires such as MinGW version of Zlib, GLIB2, etc. There are no packages available in the official Ubuntu repository, but fortunately, the MinGW-related packages provided by third parties are found on the PPA, see reference [3]. The command is as follows.
sudo add-apt-repository ppa:brcha/mingw
sudo apt-get update
sudo apt-get install dh-mingw-w64 gcc-mingw-w64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 mingw32-pkg-config
2. Installing dependent libraries
sudo apt-get install mingw32-zlib mingw32-glib2
3. Get the QEMU source code
git clone [email protected]:qemu/qemu.git (You can download the code using the git clone https://github.com/qemu/qemu.git command if you don't have GitHub registered)
CD QEMU
git submodule update--init Pixman
git submodule update--init DTC
4. Compiling
./configure--cross-prefix=i686-w64-mingw32-
Make-j10
Without an accident, the compilation will be completed soon. Executable Find. -name "*.exe" to find all the compiled QEMU executables. To run the compiled Qemu-system-arm.exe copy to a Windows system, the popup dialog prompts for the missing DLL file, and you can find the DLL file from find/usr/-name "*.dll". After you copy all of the DLL files that you depend on to the same directory as Qemu-system-arm.exe, QEMU runs.
Reference:
[1] http://wiki.qemu.org/Hosts/W32
[2] Http://lists.gnu.org/archive/html/qemu-discuss/2014-10/msg00031.html
[3] Https://launchpad.net/~brcha/+archive/ubuntu/mingw
Use MinGW to compile the latest version of QEMU on Ubuntu system