Use MinGW to compile the latest version of QEMU on Ubuntu system

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.