通过官方仓库安装
官方文档:https://www.qemu.org/download/#linux
Ubuntu
容易安装,但是版本有可能更新不及时:
sudo apt-get install qemu
通过源码编译安装
官方文档:https://www.qemu.org/download/#source
安装步骤
首选下载源码
官方地址太慢了,这里去清华镜像源 https://mirror.tuna.tsinghua.edu.cn/help/qemu.git/ 下载源码
git clone https://mirrors.tuna.tsinghua.edu.cn/git/qemu.git
然后编译安装
$ cd qemu/
$ ./configure
$ make
RISC-V 相关
官方文档:https://wiki.qemu.org/Documentation/Platforms/RISCV
这里如果想用 QEMU 模拟其他平台,可以在配置时指定,例如对于 RV64:
./configure --target-list=riscv64-softmmu && make
对于 RV32:
./configure --target-list=riscv32-softmmu && make
常见报错及处理
缺少 glib2
报错
ERROR: glib-2.48 gthread-2.0 is required to compile QEMU
解决方案:
搜索可能的软件
$ apt-cache search glib2
libglib2.0-0 - GLib library of C routines
libglib2.0-bin - Programs for the GLib library
libglib2.0-data - Common files for GLib library
libglib2.0-dev - Development files for the GLib library
libglib2.0-dev-bin - Development utilities for the GLib library
libglib2.0-doc - Documentation files for the GLib library
libpackagekit-glib2-18 - Library for accessing PackageKit using GLib
libpackagekit-glib2-dev - Library for accessing PackageKit using GLib (development files)
libpulse-mainloop-glib0 - PulseAudio client libraries (glib support)
libdbus-glib2.0-cil - CLI implementation of D-Bus (GLib mainloop integration)
libdbus-glib2.0-cil-dev - CLI implementation of D-Bus (GLib mainloop integration) - development files
libfso-glib2 - freesmartphone.org GLib-based DBus bindings
libglib2.0-cil - CLI binding for the GLib utility library 2.12
libglib2.0-cil-dev - CLI binding for the GLib utility library 2.12
libglib2.0-tests - GLib library of C routines - installed tests
libimglib2-java - multidimensional image processing library in Java
libimglib2-java-doc - documentation for ImgLib2
libntrack-glib2 - glib API for ntrack
libtaglib2.1-cil - CLI library for accessing audio and video files metadata
ruby-glib2 - GLib 2 bindings for the Ruby language
选择安装 libglib2.0-dev
即可:
sudo apt-get install libglib2.0-dev
缺少 pixman
报错
ERROR: pixman >= 0.21.8 not present.
Please install the pixman devel package.
解决方案:
搜索可能的软件
$ apt-cache search pixman
libpixman-1-0 - pixel-manipulation library for X and cairo
libpixman-1-dev - pixel-manipulation library for X and cairo (development files)
选择安装 libpixman-1-dev
即可:
sudo apt-get install libpixman-1-dev
来源:oschina
链接:https://my.oschina.net/u/4389867/blog/4490675