MSys2安装QT5

0 / 487

msys2的作用:将在linux上跑的程序,编译为exe或者dll,运行在windows上。

MSYS2 (Minimal SYStem 2) 是一个MSYS的独立改写版本,主要用于 shell 命令行开发环境。同时它也是一个在Cygwin (POSIX 兼容性层) 和 MinGW-w64(从”MinGW-生成”)基础上产生的,追求更好的互操作性的 Windows 软件。 MSYS2 是MSYS的一个升级版,准确的说是集成了pacman(我喜欢叫吃豆人)和Mingw-w64的Cygwin升级版, 提供了bash shell等linux环境、版本控制软件(git/hg)和MinGW-w64 工具链。与MSYS最大的区别是移植了 Arch Linux的软件包管理系统 Pacman(其实是与Cygwin的区别)。

  1. MSYS2 shell
# pacman –Syuu
  1. Reopen MSYS2
# pacman –Syuu

3.添加国内源

msys64\etc\pacman.d 目录下有三个文件

1. mirrorlist.msys

Server = [http://mirrors.ustc.edu.cn/msys2/msys/$arch/](http://mirrors.ustc.edu.cn/msys2/msys/$arch/)

2. mirrorlist.mingw64

Server = [http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/](http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/)

3. mirrorlist.mingw32

Server = [http://mirrors.ustc.edu.cn/msys2/mingw/i686/](http://mirrors.ustc.edu.cn/msys2/mingw/i686/)
  1. 安装GCC和common build tools
pacman -S --needed base-devel

pacman -S --needed mingw-w64-i686-toolchain

pacman -S --needed mingw-w64-x86_64-toolchain

pacman -S --needed git subversion mercurial

pacman -S --needed mingw-w64-i686-cmake

pacman -S --needed mingw-w64-x86_64-cmake

安装包

pacman -S vim

查找包

pacman -Sl |grep tar

5.修改环境变量

将下列地址添加到环境变量:

C:\msys64\mingw64\x86_64-w64-mingw32\bin

C:\msys64\mingw64\bin

C:\msys64\mingw64\local\bin

6.安装基本组件

pacman -S mingw-w64-x86_64-nasm

pacman -S mingw-w64-x86_64-lld

pacman -S mingw-w64-x86_64-pkg-config

pacman -S mingw-w64-x86_64-python3-pkgconfig

pacman -S m4

pacman -S autoconf

pacman -S automake

pacman -S mingw-w64-x86_64-cyrus-sasl

pacman -S mingw-w64-x86_64-extra-cmake-modules

pacman -S mingw-w64-x86_64-libzip

pacman -S libiconv

pacman -S mingw-w64-x86_64-iconv

pacman -S mingw-w64-x86_64-libjpeg-turbo

pacman -S mingw-w64-x86_64-libpng

pacman -S liblzma-devel

pacman -S lz4

pacman -S liblz4-devel

pacman -S mingw-w64-x86_64-python3-lz4

pacman -S mingw-w64-x86_64-libwebp

pacman -S mingw-w64-x86_64-libgeotiff

pacman -S sqlite

pacman -S libsqlite-devel

pacman -S mingw-w64-x86_64-libfreexl

pacman -S mingw-w64-x86_64-readosm

pacman -S mingw-w64-x86_64-glib-openssl

pacman -S openssl-devel

pacman -S mingw-w64-x86_64-glib-openssl

pacman -S mingw-w64-x86_64-python3-pyopenssl

pacman -S mingw-w64-x86_64-libxml2

pacman -S libxml2-devel

pacman -S libxml2-python

pacman -S mingw-w64-x86_64-tinyxml2

pacman -S mingw-w64-x86_64-freetype

pacman -S mingw-w64-x86_64-fontconfig

pacman -S mingw-w64-x86_64-cairo

pacman -S mingw-w64-x86_64-python3-cairo

pacman -S libcurl-devel

pacman -S mingw-w64-x86_64-minizip2

7.安装QT

pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-clang-analyzer

pacman -S mingw-w64-x86_64-qt5 mingw-w64-x86_64-qt-creator