4

I am trying to install MinGW64 on Windows 10. Here is what I tried:

Approach 1

Via http://mingw-w64.org/doku.php

I went to http://mingw-w64.org/doku.php/download/win-builds and from there to http://win-builds.org/doku.php/download_and_installation_from_windows where I downloaded Win-builds 1.5.0. I run the exe and let it install everything. When it gets to install mingw64 it says that the Download failed (no further information). What should I do?

Approach 2

Via https://sourceforge.net/projects/mingw-w64/

I also downloaded mingw-w64-v7.0.0 from https://sourceforge.net/projects/mingw-w64/, extracted the zip but have not idea what to do with the contents:

13.02.2020  13:37                   .gitignore
13.02.2020  13:37            31.032 aclocal.m4
13.02.2020  13:37             2.398 AUTHORS
13.02.2020  13:37    <DIR>          build-aux
13.02.2020  13:37               625 config.h.in
13.02.2020  13:37           123.961 configure
13.02.2020  13:37             3.268 configure.ac
13.02.2020  13:37             2.326 COPYING
13.02.2020  13:37    <DIR>          COPYING.MinGW-w64
13.02.2020  13:37    <DIR>          COPYING.MinGW-w64-runtime
13.02.2020  13:37             2.245 DISCLAIMER
13.02.2020  13:37               454 DISCLAIMER.PD
13.02.2020  13:37               745 Makefile.am
13.02.2020  13:37            25.337 Makefile.in
13.02.2020  13:38    <DIR>          mingw-w64-crt
13.02.2020  13:38    <DIR>          mingw-w64-doc
13.02.2020  13:39    <DIR>          mingw-w64-headers
13.02.2020  13:39    <DIR>          mingw-w64-libraries
13.02.2020  13:39    <DIR>          mingw-w64-tools

Approach 3

From: mingw-w64 installer "the file has been downloaded incorrectly"

In https://stackoverflow.com/a/48519212/4533188 it was said that should download from https://sourceforge.net/projects/mingw-w64/files/mingw-w64/, so I went there downloaded MinGW-W64-install.exe and ran it. The post says further

Once the compressed file downloaded, you have just to extract and copy/paste the MinGW64 folder( with the pre-compiled librairies) to your chosen folder ( in my case : C:\mingw64)

but I got a lot of files installed to C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\. So I copied the files of the folder to C:\MinGW64, but it seems I still do not have it installed.

Approach 4

From How to install MinGW-w64 and MSYS2?

I went to https://www.msys2.org/, downloaded the x86_64 version, went through the steps outlined in https://stackoverflow.com/a/40800825/4533188 - except for point 7. which I substituted with running pacman -S mingw-w64-x86_64-cmake. This seems to have worked, but the folder C:\MinGW64 is empty and running gcc.exe --version says, the command could not be found. I have no idea where msys2 installed what and how I have to link/move what to get gcc to run.

M.M
  • 138,810
  • 21
  • 208
  • 365
Make42
  • 12,236
  • 24
  • 79
  • 155

5 Answers5

5

The following approach did work for me. I got there via the link in https://stackoverflow.com/a/39113943/4533188

  1. Got to https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/
  2. Click on the newest version (e.g. 8.1.0)
  3. Click on x86_64-posix-sjlj
  4. Download the 7z-Archive

Alternative way of clicking around:

  1. Got to https://sourceforge.net/projects/mingw-w64/
  2. Click on files
  3. Click on x86_64-posix-sjlj of the version you want
  4. Download the 7z-Archive

Then:

  1. Unzip the archive
  2. Inside it there is the folder mingw64 - move it (and its contents) into C:\MinGW64
  3. The gcc can be found at C:\MinGW64\mingw64\bin\gcc.exe
Otiel
  • 18,404
  • 16
  • 78
  • 126
Make42
  • 12,236
  • 24
  • 79
  • 155
  • 2
    also [see here](https://stackoverflow.com/questions/29947302/meaning-of-options-in-mingw-w64-installer), sjlj might not be the best option – M.M Mar 09 '20 at 01:14
3

Regarding your approaches:

  • Approach 1 - the win-builds site is out of date and should not be used now.
  • Approach 2 - you downloaded source code, only do this if you are set up to build from source.
  • Approach 3 - it sounds like you installed it correctly and it is unclear why you feel it is not installed. NOTE - this approach goes more smoothly if you choose the option "MinGW-W64-install.exe" instead of unpacking a zip file; this will also install batch files to the start menu which set up the environment for Windows Command Prompt .
  • Approach 4 - again it sounds like you installed it correctly but have a faulty expectation about the install path. MSYS2 packages will go underneath the MSYS2 root directory. And it is not clear where you typed "gcc.exe" (you should just type gcc from the MSYS2 mingw-w64 shell, which will be accessible from start menu and desktop shortcut if you chose that during the MSYS2 install), and you probably do not want to skip step 7 (CMake relies on gmake; you could install cmake in addition to make).

For approach 4, this list of steps is slightly better than the list you linked

M.M
  • 138,810
  • 21
  • 208
  • 365
0

I had a similar problem installing MINGW-W64. What I did was to Run as Administrator, make sure the installation path contains no spaces.

Initially, I was installing it at C:/Program Files (x86)/Mingw-w64 so I change to install it directly on C:/Mingw-w64

Jared Forth
  • 1,577
  • 6
  • 17
  • 32
Clement Sam
  • 720
  • 7
  • 17
0

Method to switch from MinGW-w32 to MinGW-w64

  • Download the executable file of MinGW-w64 Refer the EDIT

(Executable file link may change for future releases, this is for Version 8.1.0, Kindly cross verify the latest version before installing from this link)

  • Installation Process (In Settings):
Version: PICK LATEST
Architecture: x86_64
Threads: posix
Exception: seh

If anyone is trying to add MinGW-w64 as a PATH variable and is not able to find the gdb.exe in C:\msys64\mingw64\bin, try looking for it in the Program files.

C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin

The gdb.exe and other files are located in this directory.


EDIT:

After making some changes in the launch.json file in VSCode, the MinGW-w64 GDB debugger started giving errors because there was 2 versions of MinGW in different folders i.e, MINGW and mingw64!

It is essential that the installation path does not contain any spaces
(i.e., space in "Program Files"), this will create conflicts later.

STEPS:

1. Uninstalled all the versions of GCC that was installed in the PC - Cygwin, MSYS2(32 bit) and mingw64(64 bit) and installed the MinGW-w64 again, this time using the MSYS2.

Please start afresh, if debugger is giving errors and if versions are clashing!

2. Download the MSYS2 installer from this link.

Install process is simple, follow the steps mentioned in the website!

It is essential that the installation path does not contain any spaces. Therefore, we cannot install MinGW-w64 in Program Files.

3. After Installation is complete: Open MSYS2 terminal (pink icon).

Update the package database and base packages using:

pacman -Syu

After this, Update rest of the base packages using:

pacman -Su

4. Now switch over to MSYS2 MinGW 64-bit terminal (blue icon).

To install gcc and g++ for C and C++.

For 64 bit:

pacman -S mingw-w64-x86_64-gcc

To install debugger (gdb).

For 64 bit:

pacman -S mingw-w64-x86_64-gdb

5. Now you're all SET!

Check versions:

gcc --version
g++ --version
gdb --version

6. Finally, remove the old environment variables if any are left and add the new environment variable to the PATH!

BEFORE DEBUGGING FILES IN VSCode, MAKE SURE TO ADD -g tag while building, otherwise breakpoints will be ignored by the debugger!

Footnote: It's very important to keep all the versions in one folder, if folders are different, then life will get tough later!

Vishnu
  • 495
  • 8
  • 14
0

I answered it in another post, you can check if you still get the error; mingw-w64 installer "the file has been downloaded incorrectly"

Timur Turbil
  • 1,145
  • 10
  • 13