I want to start a long-lasting thread that could gather info on choosing a GCC compiler — including information on GCC updates.

I've more than once found suggestions that using TDM-GCC has advantages over MinGW. I've installed TDM-GCC x64, and so far so good it's working fine, but admitedly it comes with a rather old version of GCC: 5.1.0! Currently, official GCC is in v6.3 [2016-12-21].

TDM-GCC was last updated in July 2015, and ships with GCC v5.1.0.

MinGW.org vs MinGW-w64.org

But what about MinGW? I find it confusing that there two separate MinGW projects, and from what I understood there isn't much comunication between the two projects (for historical reasons). My guess is that MinGW-w64 is presently the most widely used version, because of x64 support, but I find its website (both actually) not so friendly to the "uninitiated" --- I've spent quite some time reading through it, doing research and taking notes, but when it comes to choose which package to download I'm never quite sure about.

Currently, MinGW-x64 lateste release is v5.0.1 (2017-01-06). Does the 5.0.1 point to the GCC version? If so, it would mean that it lags behind TDM-GCC by one minor version.

TDM-GCC Advantages

I would like to get here some explanation of the advantages of using TDM-GCC over MinGW, with Nim.

TDM-GCC website offers a "Quirks" page listing the patches:

But that was in 2015, are these advantages still relevant today, or do the new versions of MinGW64 already solve the issues that TDM-GCC proposed to solve? Was the TDM-GCCproject abbandoned because its reasons d'etre ceased to be due to some changes in MinGW64?

If I've understood correctly, one of the main advantages of TDM-GCC was that your final compiled binaries would need no dependencies (MinGW DLL's, etc). Is that right? Is there still a DLL dependencies problem with current versions of MinGW?

Nim Installer and MinGW

Can someone provide here some more information about similar issues, and also explain better which version of MinGW/GCC Nim setup for Windows offers to install.

Hopefully this thread could become a reference to dissipate confusion regarding GCC on Windows, for Nim. I could even edit this post as new packages are released, so that the the head of the thread always provides updated info.

2017-01-28 14:41:52
I'm in the same situation, I'd like to bundle some recent GCC version with Nim and don't know what to pick. The official GCC website doesn't list TDM-GCC though, so I'll likely pick mingw64 in the 2 variants: 32 and 64 bit. 2017-01-29 00:44:47

I really find MinGW-64 website difficult to navigate for info. I've been going through the various release files but I can't find any mention of the GCC compiler version that ships with it.

I've also come across another GCC for Win version, "Equation":

http://www.equation.com/servlet/equation.cmd?fa=fortran

This one offers different bundles, the latest one being GCC 6.2.0. They also offer dev snapshots, last one was published just a few days ago.

2017-01-29 22:04:41

Sharing a bit of personal experience: within the mingw-w64 project I found the following folder that holds the latest GCC builds: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/

Also offers to choose between posix vs win32 and seh vs sjlj

2017-02-01 07:01:13

Thanks for the link @Greglefox.

From the files on that page I noticed that MinGW-64 is maintaining parallel releases with different GCC versions:

  • GCC-6.3.0
  • GCC-6.2.0
  • GCC-5.4.0

The lowest GCC version of the above list if way more up-to-date than latest relase of TDM-GCC (GCC v5.1.0)!

It's my guess that the reason MinGW is keeping different versions of GCC is for code compatibility issues.

As form Nim, which version of GCC is reccomended? Or are they just the same when it comes to the C compiler?

2017-02-01 17:29:19
Here (Windows 7, 64-bit) Nim compiles (using MSys2 with gcc 6.3.0) 32-bit, and 64-bit programs (and itself) w/o problems... The compilation process is initiated via cmd. 2017-02-01 18:08:08

The most recent versions of Mingw-w64 are only available 'officially' via Msys2, although as mentioned earlier, you can download builds from the sourceforge directories.

I personally wish we could use clang, and perhaps have a headless download of the Windows SDK (instead of the 10+ GB behemoth that is Visual Studio). I dislike things such as MinGW using mscvrt.dll and having programs which use threading be linked to yet another LGPL dll.

2017-02-02 01:24:44
What about the nuwen distro ?
2017-02-05 00:42:48

I am using Msys2 + Mingw64 on win7 64 bits. Almost everything is ok, except:

1. for blas, for exampe https://forum.nim-lang.org/t/3029

$ cd /r/arraymancer/tests/
$ nim c -r test_operators_blas
Hint:  [Link]
Hint: operation successful (27703 lines compiled; 8.213 sec total; 208.863MiB peakmem; Debug Build) [SuccessX]
Hint: R:\arraymancer\tests\test_operators_blas.exe  [Exec]
could not import: cblas_sscal
Error: execution of an external program failed: 'R:\arraymancer\tests\test_operators_blas.exe '

2017-07-06 13:46:06
2. gpu/cuda program, because there is no(?) file.a for mingw under windows for example https://github.com/unicredit/nimcuda
$ cd /r/nimcuda-master/examples/
$ nim c -r fft.nim --cincludes:"/r/nimcuda-master/c2nim"

CC: nimcuda_cuComplex
R:\nimcuda-master\examples\nimcache\nimcuda_fft.c:202:97: error: unknown type name 'float2'
 typedef N_CDECL_PTR(cufftResult_CsvnaTViXJFbqo9bM6i9bROw, TY_HpGapddEWLlYAX7BuEE4qA) (int plan, float2* idata, float2* odata, int direction);
                                                                                                 ^~~~~~
...

R:\nimcuda-master\examples\nimcache\stdlib_system.c:12829:3: error: unknown type name 'float2'
   float2 value;
   ^~~~~~
Hint:  [Link]
gcc.exe: error: R:\nimcuda-master\examples\nimcache\nimcuda_fft.o: No such file or directory
gcc.exe: error: R:\nimcuda-master\examples\nimcache\stdlib_system.o: No such file or directory
gcc.exe: error: R:\nimcuda-master\examples\nimcache\nimcuda_cufft.o: No such file or directory
gcc.exe: error: R:\nimcuda-master\examples\nimcache\nimcuda_cuComplex.o: No such file or directory
gcc.exe: error: R:\nimcuda-master\examples\nimcache\nimcuda_vector_types.o: No such file or directory
Error: execution of an external program failed: 'gcc.exe   -o R:\nimcuda-master\examples\fft.exe  R:\nimcuda-master\examples\nimcache\nimcuda_fft.o R:\nimcuda-master\examples\nimcache\stdlib_system.o R:\nimcuda-master\examples\nimcache\nimcuda_cufft.o R:\nimcuda-master\examples\nimcache\nimcuda_cuComplex.o R:\nimcuda-master\examples\nimcache\stdlib_math.o R:\nimcuda-master\examples\nimcache\nimcuda_vector_types.o R:\nimcuda-master\examples\nimcache\nimcuda_library_types.o R:\nimcuda-master\examples\nimcache\nimcuda_cuda_runtime_api.o R:\nimcuda-master\examples\nimcache\nimcuda_driver_types.o R:\nimcuda-master\examples\nimcache\nimcuda_surface_types.o R:\nimcuda-master\examples\nimcache\nimcuda_texture_types.o R:\nimcuda-master\examples\nimcache\nimcuda_nimcuda.o R:\nimcuda-master\examples\nimcache\nimcuda_cublas_api.o R:\nimcuda-master\examples\nimcache\nimcuda_cublas_v2.o R:\nimcuda-master\examples\nimcache\nimcuda_cuda_occupancy.o R:\nimcuda-master\examples\nimcache\nimcuda_cudnn.o R:\nimcuda-master\examples\nimcache\nimcuda_curand.o R:\nimcuda-master\examples\nimcache\nimcuda_cusolver_common.o R:\nimcuda-master\examples\nimcache\nimcuda_cusolverDn.o R:\nimcuda-master\examples\nimcache\nimcuda_cusolverRf.o R:\nimcuda-master\examples\nimcache\nimcuda_cusolverSp.o R:\nimcuda-master\examples\nimcache\nimcuda_cusparse.o R:\nimcuda-master\examples\nimcache\nimcuda_nvblas.o R:\nimcuda-master\examples\nimcache\nimcuda_nvgraph.o
2017-07-06 13:46:52
<<<••12••>>>