工程师 - MSYS2介绍
https://www.msys2.org/
MSYS2 是一系列工具和库,为您提供了一个易于使用的环境,用于构建、安装和运行本地 Windows 软件。
MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software.
它由名为 mintty 的命令行终端、bash、版本控制系统(如 git 和 subversion)、工具(如 tar 和 awk),甚至构建系统(如 autotools)组成,所有这些都基于 Cygwin 的改进版本。尽管其中一些核心部分是基于 Cygwin 的,但 MSYS2 的主要重点是为本地 Windows 软件提供一个构建环境,并将使用 Cygwin 的部分保持在最低水平。MSYS2 为 GCC、mingw-w64、CPython、CMake、Meson、OpenSSL、FFmpeg、Rust、Ruby 等提供了最新的本地构建环境。
It consists of a command line terminal called mintty, bash, version control systems like git and subversion, tools like tar and awk and even build systems like autotools, all based on a modified version of Cygwin. Despite some of these central parts being based on Cygwin, the main focus of MSYS2 is to provide a build environment for native Windows software and the Cygwin-using parts are kept at a minimum. MSYS2 provides up-to-date native builds for GCC, mingw-w64, CPython, CMake, Meson, OpenSSL, FFmpeg, Rust, Ruby, just to name a few.
为了方便安装软件包和更新软件包,它采用了一个名为 Pacman 的软件包管理系统,Arch Linux 用户对这个系统应该不陌生。它带来了许多强大的功能,如依赖关系解决和简单的完整系统升级,以及直接和可重复的软件包构建。我们的软件包仓库包含 3300 多个预制软件包,随时可供安装。
To provide easy installation of packages and a way to keep them updated it features a package management system called Pacman, which should be familiar to Arch Linux users. It brings many powerful features such as dependency resolution and simple complete system upgrades, as well as straight-forward and reproducible package building. Our package repository contains more than 3300 pre-built packages ready to install.
更多详情,请参阅 “什么是MSYS2?”,其中还将MSYS2与其他软件发行版和开发环境(如Cygwin、WSL、Chocolatey、Scoop......)进行了比较,以及 “谁在使用MSYS2?”,以了解哪些项目正在使用MSYS2以及使用的目的。
For more details see 'What is MSYS2?' which also compares MSYS2 to other software distributions and development environments like Cygwin, WSL, Chocolatey, Scoop, ... and 'Who Is Using MSYS2?' to see which projects are using MSYS2 and what for.
Installation
1, 下载安装文件:msys2-x86_64-20241116.exe
https://github.com/msys2/msys2-installer/releases/download/2024-11-16/msys2-x86_64-20241116.exe
(可选)有关安装程序的更多信息,如命令行选项,或如何验证安装程序的校验和签名,请参阅安装程序指南。
(Optional) For more information on the installer, like command line options, or how to verify the checksum and signature of the installer, see the installer guide.
2, Run the installer. Installing MSYS2 requires 64 bit Windows 10 or newer.
运行安装程序。安装 MSYS2 需要 64 位 Windows 10 或更新版本。
3, Enter your desired Installation Folder (short ASCII-only path on a NTFS volume, no accents, no spaces, no symlinks, no subst or network drives, no FAT).
输入所需的安装文件夹(NTFS 卷上的仅 ASCII 短路径,无重音符号、无空格、无符号链接、无子驱动器或网络驱动器、无 FAT)。
4, When done, click Finish.
完成后,单击 “完成”。
5, Now MSYS2 is ready for you and a terminal for the UCRT64 environment will launch.
现在 MSYS2 已经准备就绪,UCRT64 环境的终端也将启动。
6, You will probably want to install some tools like the mingw-w64 GCC to start compiling projects. Run the following command:
您可能需要安装一些工具(如 mingw-w64 GCC)来开始编译项目。运行以下命令
$ pacman -S mingw-w64-ucrt-x86_64-gcc
7, The terminal window will show the output as below. Press 'Enter' to continue:
终端窗口将显示如下输出。按 “回车键 ”继续:
resolving dependencies...
looking for conflicting packages...
Packages (15) mingw-w64-ucrt-x86_64-binutils-2.41-2
mingw-w64-ucrt-x86_64-crt-git-11.0.0.r216.gffe883434-1
mingw-w64-ucrt-x86_64-gcc-libs-13.2.0-2 mingw-w64-ucrt-x86_64-gmp-6.3.0-2
mingw-w64-ucrt-x86_64-headers-git-11.0.0.r216.gffe883434-1
mingw-w64-ucrt-x86_64-isl-0.26-1 mingw-w64-ucrt-x86_64-libiconv-1.17-3
mingw-w64-ucrt-x86_64-libwinpthread-git-11.0.0.r216.gffe883434-1
mingw-w64-ucrt-x86_64-mpc-1.3.1-2 mingw-w64-ucrt-x86_64-mpfr-4.2.1-2
mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-4
mingw-w64-ucrt-x86_64-winpthreads-git-11.0.0.r216.gffe883434-1
mingw-w64-ucrt-x86_64-zlib-1.3-1 mingw-w64-ucrt-x86_64-zstd-1.5.5-1
mingw-w64-ucrt-x86_64-gcc-13.2.0-2
Total Download Size: 49.38 MiB
Total Installed Size: 418.82 MiB
:: Proceed with installation? [Y/n]
[... downloading and installation continues ...]
8, Now you can call gcc to build software for Windows.
现在你可以调用 gcc 为 Windows 构建软件了。
$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 13.2.0
9, After installing MSYS2 it will update itself via pacman, see the update guide for more information.
安装 MSYS2 后,它会通过 pacman 进行自我更新,更多信息请参阅更新指南。
MSYS2支持的基本可安装包:
Base Packages - MSYS2 Packages
MSYS
MSYS是 "Minimal SYStem "的缩写,是一个Bourne Shell命令行解释器系统。作为微软cmd.exe的替代品,它提供了一个通用的命令行环境,特别适合与MinGW一起使用,以便将许多开源应用程序移植到MS-Windows平台上;它是Cygwin-1.3的轻量级分支,包括一小部分Unix工具,来帮助实现开源应用程序移植到Windows上。
MSYS是Cygwin的简化版,和MinGW一样,从2010年开始项目停止并不再使用了。
MSYS2
一个简化的Cygwin,是其一个分支,继承了msys的修改,并与Cygwin的功能保持同步,集成在Pacman(软件包管理器)里。