How to properly set-up your MSYS2 #144
Replies: 1 comment 2 replies
-
Per discussion in Discord earlier, some feedback re: MSYS2
https://www.msys2.org/wiki/History/
https://www.msys2.org/docs/environments/
At one point MINGW64 was the basic recommendation, but it uses MSVCRT and at this point most projects don't need it unless it's a strict requirement. Also, Microsoft's UCRT has some clear advantages, e.g. proper support for the UTF-8 locale. So, in the README, etc. you'd want to suggest
i.e. the UCRT64 works great for Nim, but the best environment for Nim on x86_64 might be CLANG64. It has the advantages of UCRT64 over MINGW64 and it has native thread-local storage, not the emulated gcc stuff in UCRT64 and MINGW64, which can have a serious performance impact.
MSYS2 toolchains are intended to be used in an MSYS2 Bash session not |
Beta Was this translation helpful? Give feedback.
-
Installation
The first step is to install the MSYS2 into your machine, for this, see their getting started and installation instructions.
Make sure you understood how they properly works because they provides a lot of different toolchains to work with. Read their introduction for this.
Once you understood their processes, concepts and installed it, you can go to the next step: Set up the environment.
Setting up your Mingw environment
In my example, I'll set up the MinGW64 environment with:
# $ pacman --sync --refresh --sysupgrade git $ pacman --sync --refresh --sysupgrade base-devel $ pacman --sync --refresh --sysupgrade mingw-w64-x86_64-toolchain
base-devel
: provides a set for building packages with makepkg.mingw-w64-x86_64-toolchain
: provides a set of packages for development as GCC, Make, pkg-config, binutils...Warning
I had some issues using the
git
from MSYS2 on VScode's extensions as GitLens. I recommend download the git from their website instead. Thegit
itself works fine, but not when used from extensions.Or download from winget:
Setting up your system's PATH
After installed, make sure you added your paths into your system's PATH. This would be something similar to, in this order:
I prefer put
mingw/bin
before theusr/bin
to prefer the tools from MinGw64's environment instead of the MSYS environment.Notice that my
Git
was put before my msys64 ones because if you have twogit
s installed, it'll give preference to your git-for-windows.If you don't know how to open you system's PATH, search for "Environment Variables" in your Windows' menu, then open the "Path" option and edit it.
Beta Was this translation helpful? Give feedback.
All reactions