MSYS2 Windows的软件分发和构建平台
MSYS2
Windows的软件分发和构建平台
MSYS2是工具和库的集合,为您提供了一个易于使用的环境,用于构建,安装和运行本机Windows软件。
它由一个名为mintty的命令行终端 ,bash,git和subversion之类的版本控制系统,tar和awk之类的工具,甚至是autotools之类的构建系统,全部基于Cygwin的修改版。尽管其中一些中心部分基于Cygwin,但MSYS2的主要重点是为本机Windows软件提供构建环境,并使使用Cygwin的部分最少。MSYS2为GCC,mingw-w64,CPython,CMake,Meson,OpenSSL,FFmpeg,Rust,Ruby等提供了最新的本机版本。
为了提供易于安装的软件包并保持更新状态,它具有一个名为Pacman的软件包管理系统,Arch Linux用户应该熟悉该系统 。它带来了许多强大的功能,例如依赖性解析和简单的完整系统升级,以及直接且可复制的程序包构建。我们的软件包存储库包含2000多个预安装的软件包,可供安装。
有关更多详细信息,请参见“什么是MSYS2?”。还将MSYS2与其他软件发行版和开发环境(如 Cygwin, WSL, Chocolatey,Scoop等)和“谁在使用MSYS2?”进行了比较。查看哪些项目正在使用MSYS2以及用于什么项目。
安装
-
下载安装程序: msys2-x86_64-20201109.exe
SHA256校验和:
274a11559ede8b892da63dacab30dcf968b811fe21caccc9a1fb9137a5e56062
-
运行安装程序。MSYS2需要64位Windows 7或更高版本。
-
输入所需的安装文件夹(短ASCII路径,没有重音符号,没有空格,没有符号链接,没有替代或网络驱动器)。
-
完成后,勾选立即运行MSYS2。
-
更新软件包数据库和基本软件包。除非您的安装文件是最新的,否则将需要两个步骤。第一次运行
pacman -Syu
:$ pacman -Syu :: Synchronizing package databases... mingw32 805.0 KiB mingw32.sig 438.0 B mingw64 807.9 KiB mingw64.sig 438.0 B msys 289.3 KiB msys.sig 438.0 B :: Starting core system upgrade... warning: terminate other MSYS2 programs before proceeding resolving dependencies... looking for conflicting packages... Packages (6) bash-5.1.004-1 filesystem-2021.01-1 mintty-1~3.4.4-1 msys2-runtime-3.1.7-4 pacman-5.2.2-9 pacman-mirrors-20201208-1 Total Download Size: 11.05 MiB Total Installed Size: 53.92 MiB Net Upgrade Size: -1.24 MiB :: Proceed with installation? [Y/n] Y :: Retrieving packages... bash-5.1.004-1-x86_64 2.3 MiB filesystem-2021.01-1-any 33.2 KiB mintty-1~3.4.4-1-x86_64 767.2 KiB msys2-runtime-3.1.7-4-x86_64 2.6 MiB pacman-mirrors-20201208-1-any 3.8 KiB pacman-5.2.2-9-x86_64 5.4 MiB (6/6) checking keys in keyring 100% (6/6) checking package integrity 100% (6/6) loading package files 100% (6/6) checking for file conflicts 100% (6/6) checking available disk space 100% :: Processing package changes... (1/6) upgrading bash 100% (2/6) upgrading filesystem 100% (3/6) upgrading mintty 100% (4/6) upgrading msys2-runtime 100% (5/6) upgrading pacman-mirrors 100% (6/6) upgrading pacman 100% :: Running post-transaction hooks... (1/1) Updating the info directory file... 0 [main] pacman (42236) C:\msys64\usr\bin\pacman.exe: *** fatal error - cygheap base mismatch detected - 0x18034B408/0x180345408. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. 0 [main] pacman 427 dofork: child -1 - forked process 42236 died unexpectedly, retry 0, exit code 0xC0000142, errno 11 error: could not fork a new process (Resource temporarily unavailable) :: To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n] Y
最后的错误是预期的,不会成为问题。
-
从“开始”菜单运行“ MSYS2 MSYS”。使用以下命令更新其余的基本软件包
pacman -Su
:$ pacman -Su :: Starting core system upgrade... there is nothing to do :: Starting full system upgrade... resolving dependencies... looking for conflicting packages... Packages (20) base-2020.12-1 bsdtar-3.5.0-1 [... more packages listed ...] Total Download Size: 12.82 MiB Total Installed Size: 44.25 MiB Net Upgrade Size: 3.01 MiB :: Proceed with installation? [Y/n] Y [... downloading and installation continues ...]
-
现在,MSYS2已为您准备就绪。您可能需要安装一些工具和mingw-w64 GCC才能开始编译:
$ pacman -S --needed base-devel mingw-w64-x86_64-toolchain warning: file-5.39-2 is up to date -- skipping [... more warnings ...] :: There are 48 members in group base-devel: :: Repository msys 1) asciidoc 2) autoconf 3) autoconf2.13 4) autogen [... more packages listed ...] Enter a selection (default=all): all :: There are 19 members in group mingw-w64-x86_64-toolchain: :: Repository mingw64 1) mingw-w64-x86_64-binutils 2) mingw-w64-x86_64-crt-git [... more packages listed ...] Enter a selection (default=all): alll resolving dependencies... looking for conflicting packages... Packages (123) docbook-xml-4.5-2 docbook-xsl-1.79.2-1 [... more packages listed ...] m4-1.4.18-2 make-4.3-1 man-db-2.9.3-1 mingw-w64-x86_64-binutils-2.35.1-3 mingw-w64-x86_64-crt-git-9.0.0.6090.ad98746a-1 mingw-w64-x86_64-gcc-10.2.0-6 mingw-w64-x86_64-gcc-ada-10.2.0-6 mingw-w64-x86_64-gcc-fortran-10.2.0-6 mingw-w64-x86_64-gcc-libgfortran-10.2.0-6 mingw-w64-x86_64-gcc-libs-10.2.0-6 mingw-w64-x86_64-gcc-objc-10.2.0-6 mingw-w64-x86_64-gdb-10.1-2 mingw-w64-x86_64-gdb-multiarch-10.1-2 [... more packages listed ...] Total Download Size: 196.15 MiB Total Installed Size: 1254.96 MiB :: Proceed with installation? [Y/n] Y [... downloading and installation continues ...]
-
要使用mingw-w64 GCC开始构建,请关闭此窗口并从“开始”菜单运行“ MSYS MinGW 64位”。现在,您可以致电
make
或gcc
构建Windows的软件。 -
请查看介绍页面,以了解何时使用哪个“开始”菜单项以及要安装哪些软件包。查看 有关故障排除的《详细MSYS2安装指南》以及有关如何使MSYS2保持最新状态的其他详细信息。