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保持最新狀態的其他詳細信息。