QEMU compilation guide

The latest version at the time of writing this article is 5.20

1. Download

Download from the official website:

wget https://download.qemu.org/qemu-5.2.0.tar.xz
tar xvJf qemu-5.2.0.tar.xz
cd qemu-5.2.0

Download from GitHub:

git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive

Two, install ninja

Ninja is a speed-focused build tool launched by a Google programmer. Generally, programs on Unix/Linux are built and compiled through make/makefile. Ninja greatly improves the build speed by organizing compilation tasks in parallel, while qemu now The build system is based on ninja, so we have to install ninja first

CMake or python can be used to construct Ninja, and re2c needs to be installed first:

apt install re2c

After re2c is successfully installed, start the Ninja installation.

Ninja compilation:

git clone git://github.com/ninja-build/ninja.git && cd ninja
./configure.py --bootstrap
cp ninja /usr/bin/

After the installation is successful, use ninja --versionto view the installed version:

ninja --version
1.9.0

Three, compile QEMU

Installation dependencies:

apt install pkg-config libglib2.0-dev libmount-dev python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential autoconf automake libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texinfo zlib1g-dev unzip cmake yasm libx264-dev libmp3lame-dev libopus-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev libpixman-1-0-dev

Compile:

./configure
make

Fourth, install QEMU

make install 

View the installed version:

root@60247decd218:~/qemu/qemu-5.2.0# qemu-arm --version
qemu-arm version 5.2.0                                 

Five, easy to make mistakes

5.1 ERROR: pkg-config binary ‘pkg-config’ not found

apt install pkg-config

5.2 ERROR: glib-2.48 gthread-2.0 is required to compile QEMU

apt-get install libglib2.0-dev

5.3 ERROR: Dependency “pixman-1” not found, tried pkgconfig

apt-get install libmount-dev

Guess you like

Origin blog.csdn.net/kelxLZ/article/details/111084537