ubuntu20.04源码安装qemu8.2
本文用于记录在ubuntu20中源码编译安装qemu8.2,同时也希望能够对你有所帮助。
一、download qemu
根据自己的需求下载对应版本的qemu源码压缩包。
https://github.com/qemu/qemu/tags
二、build qemu
解压缩后,执行下述命令。执行…/configure后,会发现其他的报错信息,下面对其进行详解
mkdir build
cd build
../configure
make
三、报错信息和解决方案
(一)、缺少ensurepip 和 setuptools python 模块。
ensurepip and separately module is not found,导致python venv creation failed。
WARNING: unrecognized host CPU, proceeding with 'uname -m' output 'x86_64'
python determined to be '/usr/bin/python3'
python version: Python 3.8.10
*** Ouch! ***
Python's ensurepip module is not found.
It's normally part of the Python standard library, maybe your distribution packages it separately?
Either install ensurepip, or alleviate the need for it in the first place by installing pip and setuptools for '/usr/bin/python3'.
(Hint: Debian puts ensurepip in its python3-venv package.)
ERROR: python venv creation failed
问题一,解决方案:
sudo apt update
# python3-venv中包含ensurepip 模块
sudo apt install python3-venv
sudo apt install python3-pip
# 安装setuptools模块
pip3 install setuptools
(二)、缺少sphinx 和 Ninja python 模块。
‘sphinx’ was not found ,Cannot find Ninja,导致报错,sphinx为文档生成工具, Ninja为构建工具。
'sphinx==5.3.0' not found:
• Python package 'sphinx' was not found nor installed.
• mkvenv was configured to operate offline and did not check PyPI.
Sphinx not found/usable, disabling docs.
ERROR: Cannot find Ninja
问题二,解决方案:
sudo apt install python3-pip
# 安装Sphinx
pip3 install Sphinx sphinx_rtd_theme
# 安装ninja
sudo apt install ninja-build
(三)、 “glib-2.0” not found
glib-2.0是一个常用的C语言库,用于编写应用程序和服务端程序。
../meson.build:710:10: ERROR: Dependency "glib-2.0" not found, tried pkgconfig
A full log can be found at /home/hhl/software/qemu-8.2.0/build/meson-logs/meson-log.txt
ERROR: meson setup failed
问题三,解决方案:
sudo apt install libglib2.0-dev
(四)、‘flex’ not found
flex 是一个用于生成词法分析器的工具
Program scripts/decodetree.py found: YES (/home/hhl/software/qemu-8.2.0/build/pyvenv/bin/python3 /home/hhl/software/qemu-8.2.0/scripts/decodetree.py)
Program flex found: NO
../target/hexagon/meson.build:180:8: ERROR: Program 'flex' not found or not executable
A full log can be found at /home/hhl/software/qemu-8.2.0/build/meson-logs/meson-log.txt
ERROR: meson setup failed
问题四,解决方案:
sudo apt install flex
(五)、‘bison’ not found
bison 是一个通用的解析器生成器,通常与 flex 一起使用来生成词法和语法分析器。
Program bison found: NO
../target/hexagon/meson.build:186:8: ERROR: Program 'bison' not found or not executable
A full log can be found at /home/hhl/software/qemu-8.2.0/build/meson-logs/meson-log.txt
ERROR: meson setup failed
问题五、解决方案:
sudo apt install bison
至此,执行…/configure后的报错,应该是全部都解决了。
四、编译安装qemu
在build目录中执行make命令进行编译,耐心等待。
cd build
# -j 并发编译
make -j8
cd build
# 安装qemu
sudo make install
五、验证是否安装成功
执行下述命令,验证qemu是否安装成功。
qemu-system-aarch64 -version
到这里,ubuntu中源代码编译安装qemu完成。