kayosa
kayosa

Reputation: 251

Installing the latest version of mingw-w64 on Windows

I am desperately trying to install the latest version of mingw-w64 to get acess to gcc 10 on windows 10.

I used the online installer for mingw-w64 in the past, but it is still stuck in 2018 on 8.1.0 and seems to be abandoned.

So i tried installing it manually.

On SourceForge or the GitHub Mirror you seem to only get a chunk of code without any clear instructions on what do do, how to build and install it. The only installation instructions that i managed to find required you to already have a working gcc installed (very helpful if that is what you want to get installed in the first place).

On their website and wiki there is a precompiled binary package mentioned. But the only one that i could find was horribly outdated as well.

Comparing this with the installation process of clang or the microsoft build tools, it actually blows my mind how something as basic as installation can be this confusing.

Maybe it's just me missing the obvious , but how do you actually install this thing?

Upvotes: 25

Views: 51295

Answers (7)

Abdur Rafay ID 1013
Abdur Rafay ID 1013

Reputation: 1

For anyone still searching for a solution

https://stackoverflow.com/a/30071634/23307867

go to this one and follow @rubenvb's guide and/or follow this guide too, imo @rubenvb's guide is enough

  1. Download and Install MSYS2:

    ▶ Visit the MSYS2 website and download the installer.

    ▶ Follow the installation instructions to set up MSYS2 on your system.

  2. Run MSYS2 UCRT64 Named App Instance:

    which looks like this image
    ▶ Open the MSYS2 terminal by launching the ucrt64 named app instance from your start menu or desktop shortcut.

  3. Update Package Database and Core System Packages:
    ▶ In the MSYS2 terminal, run the following command:
    pacman -Syuu

    ▶ If the terminal closes during the update, reopen the ucrt64 instance and run the command again.
    ▶ The program may ask for your approval sevaral times asking you to typeY

  4. Install Essential Development Tools and MinGW-w64 Toolchain:
    ▶ Run the following command to install the necessary packages:
    pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
    ▶ just to let you know the --needed option ensures that only outdated or missing packages are installed. The base-devel package group includes essential development tools. according to internet.

  5. Add binary folder to PATH:
    ▶ If you did not change the default installation path/folder your bin folder location should be this - C:\msys64\ucrt64\binadd it to your system environment variables PATH.

  6. Update MinGW-w64:
    ▶ To update MinGW-w64 in the future, repeat from step 3.

  7. Verify the Compiler Installation:
    ▶ To check if the compiler is working, run the following command in the terminal:
    gcc --version
    g++ --version
    gdb --version

Upvotes: 0

Vuniverse
Vuniverse

Reputation: 1

There is an installer with GUI, and you can pick any version

https://github.com/Vuniverse0/mingwInstaller/releases

Upvotes: 0

Brecht Sanders
Brecht Sanders

Reputation: 7287

GCC 10 is officially released. The personal build for Windows (MinGW-w64) that can be downloaded from https://winlibs.com requires no installation, just extract to a folder.

Upvotes: 25

Ram Dhiwakar S
Ram Dhiwakar S

Reputation: 1

Go to Environment Variables. You should find it by searching for it in the search pane of control panel. As soon as you click Environment variables, you should see a new pop-up. Click the edit under System Variable. Navigate till you find 'PATH'. Click Edit.

Now very important steps. You will see an existing address under 'Variable Value'. Copy that (preferably to a Text doc). In that address, Delete the address containing mingw32 between two semicolons. And now add the address of the newly installed version's 'bin' folder (anywhere you want, importantly,between two semicolons).

Then paste the whole new address back again to the Variable Value field. Click OK for everything.

It should mostly work now. This is what I did. You can check if it updated by running 'g++ --version' in the CMD.

Upvotes: 0

M.M
M.M

Reputation: 141554

Installing via MSYS2 will give you gcc 10.1 .

You can treat MSYS2 as a package manager for keeping gcc up to date, and not use its shell if you like. Its packages include standalone 32-bit gcc, standalone 64-bit gcc, and MSYS2-target gcc. It is a very similar process to installing gcc via package manager on a Linux system.


how something as basic as installation can be this confusing

This is not uncommon with open source when there's no customer income stream to pay developers to build and maintain a smooth installer. Someone has to do the work of hosting and maintaining binary builds and often people will do it for a while out of the goodness of their heart, and then move on, as seems to have happened with the "official" mingw-builds installer.

So while the solutions you see on this thread today will work for now, in a few years' time the answers may be different

Upvotes: 1

datenwolf
datenwolf

Reputation: 162164

I recommend obtaining MinGW through MSys2 https://www.msys2.org/

First install MSys2, then perform a full update by first updating the package database and updating pacman

pacman -SySu

After the update is done it will ask you to close the terminal without exiting to shell. Do so, then perform a full update by running

pacman -Su

after which you can install the mingw-w64 packages. Use

pacman -Ss mingw

to list all available packages. Install with

pacman -S ${PACKAGE_NAME}

Upvotes: 2

jacob
jacob

Reputation: 1630

Building GCC on Windows from source code is very difficult and cannot be recommended to beginners. Moreover, GCC 10 has not yet been officially released and you may need to wait a few more weeks to get it.

If you want an up-to-date GCC in Windows (currently version 9.3), I recommend downloading and installing the MSYS2 package. Once you install it, launch it using the "MinGW64" icon and install the correct compiler in the terminal. For details, see this question: How to install MinGW-w64 and MSYS2?

Once you have done this, you can forget about MSYS2 and simply use the directory with the binaries in your PATH.

The maintainers of MSYS2 are very keen in supporting bleeding edge software, so once GCC 10 is released, you will be able to update to it (using the command pacman -Syu) very soon.

Upvotes: 4

Related Questions