59

I am trying to install mingw-w64 onto Windows. However I receive an error, "the file has been downloaded incorrectly". Redownloading the setup file again from sourceforge does not fix the problem. Is there an alternative way to install it or am I doing something wrong?

Crook
  • 733
  • 1
  • 6
  • 9
  • I had the same problem but chaning version to the second newest (from 7.3.0 to 7.2.0) solved it – Xeverous Apr 20 '18 at 17:04
  • I suggest trying the manual method outlined here: http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite I had the same issue and that's what I did. You can also try this setup tool http://cfhcable.dl.sourceforge.net/project/mingw/Installer/mingw-get-setup.exe I had issues with both tools hence the manual way which is very painful. Goodluck. – user264431 Sep 27 '17 at 23:24
  • I couldn't execute from download folder in win10, copied the exe file to c/temp and executed from there fine – Sergio Solorzano Feb 27 '22 at 09:17

7 Answers7

45

Old post but same problem, the installer doesn't seem to work.

I give the solution which works for me

You can directly download the archive of MinGW64 with your chosen configuration :

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

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)

demiton
  • 685
  • 9
  • 9
42

I got same error and solved it, after struggling a few hours. You should download MinGW64 via https://winlibs.com/#download-release. enter image description here

After downloading, You should unzip mingw64 file to a folder(in my case I unzipped it to c disk; C:\mingw64)

And then you have to set up path. for that follow below steps;

  1. open settings.
  2. Search for Edit environment variables for your account.
  3. choose path variable and then select edit.
  4. Select New and add the Mingw-w64 folder path(bin folder). In my case, I added (C:\mingw64\bin).
  5. Select OK to save the updated path. And reopen your cmd, then check if everything is good by typing; gcc --version
Timur Turbil
  • 1,145
  • 10
  • 13
  • Worked for me but I installed tghe Zip Archive and not the 7-Zip – Okabe Apr 12 '22 at 12:55
  • Very nice, it worked! – jksevend Apr 19 '22 at 17:44
  • 1
    This method looked sketchy, but it indeed worked and I recommend it as a solution. If winlibs didn't have a few things to help me validate it, I woulda avoided as possible virus....even then I still see this as taking a chance. It had a wiki page which granted credibility, but even a fake wiki page and multiple fake variable downloadable releases on the main site wouldn't surprise me at this point. – kite May 09 '22 at 00:18
  • Thank you. All the other methods did not work. You linked to the correct URL to simply unzip it and build a path variable. – user3669653 Aug 15 '22 at 21:10
  • the only one who worked for me. – porcumare1234 Oct 26 '22 at 18:03
11

Long story short, the official installer is broken and not been fixed for years, so we have to install it manually.


installer_download_link

The official download link above would bring you to sourceforge: https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/installer/mingw-w64-install.exe

And in the same folder that contains the installer, there's a repository.txt. (about this file) repository

Take a look at it, the installer basically just download and unzip the build from one of these urls within repository.txt. Choose the url you want and download/upzip it manually. (In my case, I use 8.1.0|x86_64|posix|seh|rev0 setup) repository.txt

Last, setup the Path environment variable pointing to your unzipped bin folder, let say C:\mingw64\bin, and this should do the trick.

Rohim Chou
  • 907
  • 10
  • 16
  • 1
    Great answer. I do have one question however. Which environment variable? PATH? – Rugnir May 17 '22 at 23:56
  • 1
    This is the only correct answer, because it installs exactly what the installer would. The other answers install some other MinGW-w64 distributions that may or (more often) may not work for the intended purpose. – AndreKR Mar 26 '23 at 22:16
6

Finally, I solved this problem by downloading this:http://winlibs.com/

GCC 10.1.0 + LLVM/Clang/LLD/LLDB 10.0.0 + MinGW-w64 7.0.0 - release 3 (LATEST) Win32: 7-Zip archive* | Zip archive Win64: 7-Zip archive* | Zip archive

and set the %path%

After that, I still can't execute gcc correctly, but then I solved the problem by adding this environment variable:

"CGO_ENABLED=1"

I encountered the problem when using this golang package: https://github.com/mattn/go-sqlite3

meowalien
  • 101
  • 1
  • 6
  • This ([file downloaded incorrectly](https://semicolon.dev/tutorial/webdev/mingw-file-downloaded-incorrectly)) is one of the best tutorial on the subject as it points out the only solution that worked for me. And its [video](https://www.youtube.com/watch?v=Zcy981HhGw0) counterpart here. – InfiniteStack Jul 30 '22 at 04:29
2

Following this tutorial helped me manually install MinGW for windows : youtube

So the problem for me was that when I tried to use the .exe installer, it either showed me that, "the file has been downloaded incorrectly" , or , the /.../bin folder did not have any files in it.

In the link above, the MinGW files (including the /bin files) were manually downloaded and identified properly by the Environment Variables.

Awshaf Ishtiaque
  • 441
  • 5
  • 11
1

I received the same error. When I re-ran the installer as an adminstrator it was installed successfully.

I also made sure not to add any spaces to the installation path.

  • 2
    I both ran the installer as an administrator and made sure that the path didn't have any spaces, it didn't fix it for me unfortunately. – MyNameIsTrez Mar 30 '22 at 22:05
-3

The problem is with your internet connection and/or ISP. I'm not great at networking so I'll let others be more specific. I tried installing/downloading it using my mobile's data as wifi hotspot and it worked. Hope it helps

Sev
  • 77
  • 1
  • 2
  • 11
  • 3
    I was able to solve it by following this [how to properly install mingw](https://www.youtube.com/watch?v=Zcy981HhGw0) video tutorial. It's not an internet issue. I struggled with this a bit, redownloaded the file, etc – InfiniteStack Apr 30 '22 at 16:13