Bootstrap

mtsys2 编译 qemu 记录

参考链接

下载 MSYS2

MSYS2

MSYS2 换源

进入目录\msys64\etc\pacman.d,

在文件mirrorlist.msys的前面插入

Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch

在文件mirrorlist.mingw32的前面插入

Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686

在文件mirrorlist.mingw64的前面插入

Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64

或者直接运行

sed -i "s#https\?://mirror.msys2.org/#https://mirrors.tuna.tsinghua.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*

MSYS2 终端(MSYS2 MINGW64),进行更新:

pacman -Syu

配置GCC工具链

$ pacman -Sy mingw-w64-x86_64-toolchain

安装gtk库

编译QEMU还需要用到glib2.0的库,pkg-config与libz的库,这些东西在gtk的开发包里面都有

$ pacman -S mingw-w64-i686-gtk2

安装qemu依赖

$  pacman -Sy mingw-w64-x86_64-meson mingw-w64-x86_64-ninja \
           mingw-w64-x86_64-python \
           mingw-w64-x86_64-python-sphinx \
           mingw-w64-x86_64-python-sphinx_rtd_theme \
           mingw-w64-x86_64-autotools \
           mingw-w64-x86_64-tools-git \
           mingw-w64-x86_64-cc \
           mingw-w64-x86_64-angleproject \
           mingw-w64-x86_64-capstone \
           mingw-w64-x86_64-curl \
           mingw-w64-x86_64-cyrus-sasl \
           mingw-w64-x86_64-expat \
           mingw-w64-x86_64-fontconfig \
           mingw-w64-x86_64-freetype \
           mingw-w64-x86_64-fribidi \
           mingw-w64-x86_64-gcc-libs \
           mingw-w64-x86_64-gdk-pixbuf2 \
           mingw-w64-x86_64-gettext \
           mingw-w64-x86_64-glib2 \
           mingw-w64-x86_64-gmp \
           mingw-w64-x86_64-gnutls \
           mingw-w64-x86_64-graphite2 \
           mingw-w64-x86_64-gst-plugins-base \
           mingw-w64-x86_64-gstreamer \
           mingw-w64-x86_64-gtk3 \
           mingw-w64-x86_64-harfbuzz \
           mingw-w64-x86_64-jbigkit \
           mingw-w64-x86_64-lerc \
           mingw-w64-x86_64-libc++ \
           mingw-w64-x86_64-libdatrie \
           mingw-w64-x86_64-libdeflate \
           mingw-w64-x86_64-libepoxy \
           mingw-w64-x86_64-libffi \
           mingw-w64-x86_64-libiconv \
           mingw-w64-x86_64-libidn2 \
           mingw-w64-x86_64-libjpeg-turbo \
           mingw-w64-x86_64-libnfs \
           mingw-w64-x86_64-libpng \
           mingw-w64-x86_64-libpsl \
           mingw-w64-x86_64-libslirp \
           mingw-w64-x86_64-libssh \
           mingw-w64-x86_64-libssh2 \
           mingw-w64-x86_64-libtasn1 \
           mingw-w64-x86_64-libthai \
           mingw-w64-x86_64-libtiff \
           mingw-w64-x86_64-libunistring \
           mingw-w64-x86_64-libunwind \
           mingw-w64-x86_64-libusb \
           mingw-w64-x86_64-libwebp \
           mingw-w64-x86_64-libwinpthread-git \
           mingw-w64-x86_64-lz4 \
           mingw-w64-x86_64-lzo2 \
           mingw-w64-x86_64-nettle \
           mingw-w64-x86_64-openssl \
           mingw-w64-x86_64-opus \
           mingw-w64-x86_64-orc \
           mingw-w64-x86_64-p11-kit \
           mingw-w64-x86_64-pango \
           mingw-w64-x86_64-pixman \
           mingw-w64-x86_64-SDL2 \
           mingw-w64-x86_64-SDL2_image \
           mingw-w64-x86_64-snappy \
           mingw-w64-x86_64-spice \
           mingw-w64-x86_64-usbredir \
           mingw-w64-x86_64-xz \
           mingw-w64-x86_64-zlib \
           mingw-w64-x86_64-zstd

下载qemu 源码并编译

$ wget https://download.qemu.org/qemu-8.2.0.tar.xz
$ tar xvJf qemu-8.2.0.tar.xz
$ cd qemu-8.2.0/
$ ./configure
$ make -j8

MSYS2 python报错处理

ERROR: Python not found. Use --python=/path/to/python

python添加环境变量

etc文件夹下的profile文件

export PATH=$PATH:/D/Users/xxx/001_tools/msys64/mingw64/bin
unset PATH_SEPARATOR

环境变量生效

source /etc/profile

打印环境变量

echo $PATH

报错处理2

ERROR: Postconf script ‘symlink-install-tree.py’ failed with exit code 1.
管理员权限配置和编译

;