MSYS2

From Omnia
Jump to navigation Jump to search

MSYS2

MSYS2
https://www.msys2.org/
Software Distribution and Building Platform for 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.
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.
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 3700 pre-built packages ready to install.
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.

Update Packages

  1. Launch an MSYS2 terminal from the Start Menu (e.g., "MSYS2 UCRT64")
  2. Update the core packages by running the following command in the MSYS2 terminal:
    • pacman -Syu

Add MSYS2 to PATH

CMD

# NOTE This version tends to add duplicates - try the Powershell version, it's better!
setx PATH "%PATH%;C:\msys64\usr\bin" /M

#setx PATH "%PATH%;C:\msys64\mingw64\bin" /M

PowerShell:

$newPath = "C:\msys64\usr\bin"
# $newPath = "C:\msys64\mingw64\bin"
$oldPath = [Environment]::GetEnvironmentVariable("Path", "Machine")
[Environment]::SetEnvironmentVariable("Path", "$oldPath;$newPath", "Machine")

MSYS2 Programs

Start Menu Scripts:

"C:\Users\ztester\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MSYS2"

MSYS2 CLANG64

C:\msys64\clang64.exe

MSYS2 CLANGARM64

C:\msys64\clangarm64.exe

MSYS2 MINGW64

C:\msys64\mingw64.exe

MSYS2 MSYS

C:\msys64\msys2.exe

MSYS2 UCRT64

C:\msys64\ucrt64.exe


Install rsync

winget install MSYS2.MSYS2
pacman -S rsync
winget install MSYS2.MSYS2 --source winget
pacman -S rsync


C:\msys64\usr\bin\rsync.exe
C:\> C:\msys64\usr\bin\rsync.exe --version
rsync  version 3.4.1  protocol version 32

Proxy SSL Certificate

Error:

error: failed retrieving file 'clangarm64.db' from mirror.msys2.org : SSL certificate problem: self-signed certificate in certificate chain

Export the necessary certificates from your browser:

  • Open https://repo.msys2.org in your web browser (Firefox, Chrome, Edge, etc.).
  • Click on the padlock icon in the address bar to view the site information and then view the certificate details.
  • Navigate to the certificate path or hierarchy and export all relevant certificates in the chain except for the final repo.msys2.org one (the intermediate and root CAs are what you need).
  • Save them as Base-64 encoded .pem or .cer files to a local directory on your Windows machine. You may need to ask your IT department for the certificates if you cannot export them.

Import the certificates into the MSYS2 trust store:

  • Open an MSYS2 shell (e.g., MSYS2 UCRT64).
C:\msys64\ucrt64.exe
  • Place the downloaded .pem or .cer files into the C:\msys64\etc\pki\ca-trust\source\anchors\ directory (adjust the path if your MSYS2 installation is in a different location).

Update the MSYS2 certificate trust:

  • In the MSYS2 shell, run the command:
update-ca-trust

Verify the fix:

  • Test the connection with curl:
curl --fail --silent --show-error -I https://repo.msys2.org -o /dev/null && echo "OK!"
pacman -Syu
pacman -Syyu

See also:


Another solution:

Copy certificate of https://www.msys2.org/ to ca-bundle.crt file in C:\msys64\usr\ssl\certs

Or something about:

mv /mnt/c/msys64/usr/ssl/certs/ca-bundle.crt /mnt/c/msys64/usr/ssl/certs/ca-bundle.crt.orig
cp repo-msys2-org-chain.pem /mnt/c/msys64/usr/ssl/certs/ca-bundle.crt

ref:

keywords