How to install 64-bit MSYS2, really?
MSYS2 won't install
See title -- it's what I'm trying to do. I'd like the MSYS2 installaton to work with Eclipse CDT, which is why I'm also taking these instructions into account. Working with CDT is not my primary goal though -- most important is to set up a 64-bit MSYS2/MinGW dev environment.
I've downloaded and installed msys2-x86_64-20250622.exe. I'm pretty sure that's the correct installer for a 64-bit Windows 10 machine, which is what I'm on. So far so good.
So I run it, and start up "MSYS2" from the Start menu, run "pacman -Syu", then "pacman -S gcc make vim".
But then I look at the instructions linked above, and it seems that "pacman -S gcc" is a mistake, even though gcc works fine from the MSYS2 command line after installation. Apparently, in order for things to work with Eclipse CDT, I should have done "pacman -S mingw-w64-ucrt-x86_64-gcc", which installs GCC stuff into /msys64/ucrt64. Strangely though, the urct64 subdir is is not on MSYS' own PATH, so after installation the binaries aren't found when called from the MSYS2 console.
So here's one question: why does MSYS2 have a "normal" GCC package (with all its dependencies), and also an alternative "UCRT64" GCC package, with its own dependencies (also marked URCT64). The suffix "64" seems to suggest that that's what I want on a 64-bit machine -- but since the MSYS2 core that I installed is itself 64-bit, I have no idea why I would have to specify the 64-bit packages explicitly -- and even less of an idea as to why the binaries inside those "ucrt64" packages aren't even put on MSYS2' own PATH.
BUT! Now things turn even more complicated when I read this MinGW page. As it turns out, the MSYS2 distributation has created multiple additional startup-links in the Windows start folder, including an "MSYS2 UCRT64", "MSYS2 CLANG64", "MSYS2 MINGW64", etc. Great! What the heck are these for? And why does each of these variants require its own variation of the GCC package and its dependencies?
And why isn't any of this explained anywhere? (Or maybe it is. But DuckDuckGo doesn't know about it.)
First of all, I'd really like to know how I produce 64-bit executables for Windows, using MSYS2. If I run the "regular" (non-UCRT64 gcc", will it create a 32-bit executable or a 64-bit?
Help please.
PS. Among the dependencies of the regular gcc package are msys2-w32api-headers and msys2-w32api-runtime. Is "win32api" an indication that using this gcc I'll be compiling for 32-bit Windows? Or is "win32api" simply the legacy name left over from the 1990's, designating the Windows API against which all Windows programs (regardless whether 32-bit or 64-bit) are compiled?
Unfortunately, the MinGW-w64 installer you used sometimes has this issue. I myself am not sure about why this happens (I think it has something to do with Sourceforge URL redirection or whatever that the installer currently can't handle properly enough).
Anyways, if you're already planning on using MSYS2, there's no need for that installer.
Download MSYS2 from this page.
After the install completes, click on the
MSYS2 UCRT64in the Start menu (orC:\msys64\ucrt64.exe).If done correctly, the terminal prompt will say
UCRT64in magenta letters, notMSYS.Update MSYS2 using
pacman -Syuu. If it closes itself during the update, restart it and repeat the same command to finish the update.You should routinely update your installation.
Install the toolchain: (i.e. the compiler and some extra tools)
pacman -S mingw-w64-ucrt-x86_64-toolchainInstall any libraries/tools you may need. You can search the repositories by doing
pacman -Ss name_of_something_i_want_to_installe.g.
pacman -Ss gsland install using
pacman -S package_name_of_something_i_want_to_installe.g.
pacman -S mingw-w64-ucrt-x86_64-gsland from then on the GSL library will be automatically found by your compiler!
Make sure any compilers and libraries you install have this package prefix:
mingw-w64-ucrt-x86_64-. Only use unprefixed packages for misc command-line utilities (such asgrep,sed,make, etc), unless you know what you're doing.Verify that the compiler is working by doing
gcc --version
If you want to use the toolchains (with installed libraries) outside of the MSYS2 environment, all you need to do is add C:/msys64/ucrt64/bin to your PATH.
MSYS2 provides several compiler flavors, UCRT64 being one of them. It should be a reasonable default.
MSYS has not been updated a long time. MSYS2 is more active, and you can download it from MSYS2. It has both the mingw and cygwin fork package.
To install the MinGW-w64 toolchain (reference):
- Open the MSYS2 shell from the start menu
- Run
pacman -Sy pacmanto update the package database - Reopen the shell, and run
pacman -Syuto update the package database and core system packages - Reopen the shell, and run
pacman -Suto update the rest - Install the compiler:
- For a 32-bit target, run
pacman -S mingw-w64-i686-toolchain - For a 64-bit target, run
pacman -S mingw-w64-x86_64-toolchain
- For a 32-bit target, run
- Select which package to install; the default is all
- You may also need
make. Runpacman -S make