Difference between revisions of "MinGW installation"

From Code::Blocks
m
Line 60: Line 60:
 
You now have a Code::Blocks environment that is configured to use TDM-GCC 32-bit properly.  Using this as a template you can easily set up alternative compilers no matter the source - just follow the same basic procedure.
 
You now have a Code::Blocks environment that is configured to use TDM-GCC 32-bit properly.  Using this as a template you can easily set up alternative compilers no matter the source - just follow the same basic procedure.
  
== MinGW-Builds ==
+
==Other MinGW links==
 
+
[http://www.equation.com/servlet/equation.cmd?fa=fortran Unofficial MinGW package From Equation.com]
 
 
== This page is in the process of being edited, all the below is from the original page and all above is what is currently being worked on ==
 
 
 
 
 
==Using the MinGW installer==
 
Note: At the present time, it is still best to download the packages by hand, as the installers are not production quality (unless you really feel unsure about unpacking a couple of archives).
 
 
 
Also, the installer reportedly does not work on Windows Vista, follow the [[MinGW_installation#GCC_3.4.5_manual_install | manual installation instructions]].<br />
 
''(In general, MinGW is not confirmed to work for any Windows Vista betas or RCs)''
 
 
 
'''MinGW has been confirmed working in Windows Vista Business!''' Thanks to [http://aarongiles.com/?p=199 Aaron Giles' Solving the Windows Vista Build Issues] for the solution.
 
In summary, the MinGW folder must be "a directory immediately off the root of your hard disk for some reason. So c:\mingw works fine, but c:\tools\mingw won’t." (You can use mklink to symbolic-link the folder, which also works). Secondly, set the GCC_EXEC_PREFIX environment variable to the MinGW root folder. Finally, add %GCC_EXEC_PREFIX%\libexec\gcc\mingw32\3.4.5 and %GCC_EXEC_PREFIX%\lib\bin to the PATH environment variable.
 
 
 
'''A HowTo exists [[Installing_MinGW_with_Vista | here]]'''
 
 
 
 
 
MinGW Installer 5.02 allows to choose the SF mirror while 5.03 does not (automatically picks one randomly).
 
 
 
MinGW Installer 5.0.x are broken because of changes done by sf.net; please use the MinGW Installer 5.1.x
 
 
 
Installers allows to downloads/installs "previous", "current" and "candidate" mingw packages.
 
 
 
*[http://prdownloads.sourceforge.net/mingw/MinGW-5.0.2.exe MinGW Installer 5.0.2]
 
*[http://prdownloads.sourceforge.net/mingw/MinGW-5.0.3.exe MinGW Installer 5.0.3]
 
*[http://prdownloads.sourceforge.net/mingw/MinGW-5.1.3.exe MinGW Installer 5.1.3]
 
 
 
'''Note that the MinGW version number is not related to the actual compiler version.'''
 
 
 
Note that the installer applications require an internet connection and will download the actual MinGW packages at the time of installation.
 
  
The required MinGW Components are "MinGW Base Tools", "g++ compiler" and "MinGW make".
+
=== MinGW-Builds ===
  
==GCC 3.4.5 manual install==
 
This is the "candidate" release of MinGW, so it is not considered "stable" officially.<br />Personally, I have not had any kind of problem with this release.
 
  
To do a manual install, simply download the desired files and extract them all into the same directory. If you have WinZip, PowerArchiver, or any other similar program, this is as easy as selecting all the archives simultaneously and choosing "unpack here" from the context menu.
 
 
For clarity, I recommend to put MinGW into C:\MinGW, but almost any other locations should do equally well. Avoid pathnames with spaces or exotic characters, as this may confuse some commandline tools (most notably <tt>gdb</tt>).
 
===Base system with C++===
 
*[http://prdownloads.sf.net/mingw/gcc-core-3.4.5-20060117-1.tar.gz http://prdownloads.sf.net/mingw/gcc-core-3.4.5-20060117-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/gcc-g%2B%2B-3.4.5-20060117-1.tar.gz http://prdownloads.sf.net/mingw/gcc-g++-3.4.5-20060117-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw-utils-0.3.tar.gz http://prdownloads.sf.net/mingw/mingw-utils-0.3.tar.gz]
 
*[http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz]
 
*[http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw32-make-3.81-1.tar.gz http://prdownloads.sf.net/mingw/mingw32-make-3.81-1.tar.gz]
 
 
===Optionally:===
 
====Fortran77 compiler====
 
*[http://prdownloads.sf.net/mingw/gcc-g77-3.4.5-20060117-1.tar.gz http://prdownloads.sf.net/mingw/gcc-g77-3.4.5-20060117-1.tar.gz]
 
====gdb debugger====
 
*[http://prdownloads.sf.net/mingw/gdb-6.3-2.exe http://prdownloads.sf.net/mingw/gdb-6.3-2.exe]
 
 
==Development Tools==
 
==Development Tools==
 
===UnxUtils===
 
===UnxUtils===
Line 148: Line 100:
 
*[http://prdownloads.sf.net/gnuwin32/libintl-0.14.4-bin.zip libintl-0.14.4 (needed by most tools)]
 
*[http://prdownloads.sf.net/gnuwin32/libintl-0.14.4-bin.zip libintl-0.14.4 (needed by most tools)]
 
*[http://prdownloads.sf.net/gnuwin32/libiconv-1.9.2-1-bin.zip libiconv-1.9.2-1 (needed by most tools)]
 
*[http://prdownloads.sf.net/gnuwin32/libiconv-1.9.2-1-bin.zip libiconv-1.9.2-1 (needed by most tools)]
 
==Resulting Folder Layout==
 
[[Image:Lay.png]]
 
 
 
==GCC 3.4.4 manual install==
 
Some people have reported various problems with gcc version 3.4.4, so it may be worth a consideration to use the either the 3.4.5 or 3.4.2 releases until a build from the 4.x branch is available.<br />Personally, I have not had any kind of problem with either 3.4.4 or 3.4.5.
 
===Base system with C++===
 
*[http://prdownloads.sf.net/mingw/gcc-core-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-core-3.4.4-20050522-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/gcc-g%2B%2B-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-g++-3.4.4-20050522-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw-utils-0.3.tar.gz http://prdownloads.sf.net/mingw/mingw-utils-0.3.tar.gz]
 
*[http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz]
 
*[http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz]
 
*[http://prdownloads.sf.net/mingw/mingw32-make-3.80.0-3.tar.gz http://prdownloads.sf.net/mingw/mingw32-make-3.80.0-3.tar.gz]
 
 
===Optionally:===
 
====gdb debugger====
 
*[http://prdownloads.sf.net/mingw/gdb-6.3-2.exe http://prdownloads.sf.net/mingw/gdb-6.3-2.exe]
 
====Objective-C====
 
*[http://prdownloads.sf.net/mingw/gcc-objc-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-objc-3.4.4-20050522-1.tar.gz]
 
====Native Java (experimental)====
 
*[http://prdownloads.sf.net/mingw/gcc-java-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-java-3.4.4-20050522-1.tar.gz]
 
====Fortran-77====
 
*[http://prdownloads.sf.net/mingw/gcc-g77-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-g77-3.4.4-20050522-1.tar.gz]
 
====Ada====
 
*[http://prdownloads.sf.net/mingw/gcc-ada-3.4.4-20050522-1.tar.gz http://prdownloads.sf.net/mingw/gcc-ada-3.4.4-20050522-1.tar.gz]
 
 
 
==Other MinGW links==
 
[http://www.equation.com/servlet/equation.cmd?fa=fortran Unofficial MinGW package From Equation.com]
 

Revision as of 00:51, 26 December 2015


GCC Compiler Toolchain Features

Various GCC compilers for Windows come with different features and which flavor of the compiler you end up choosing should reflect your specific needs.

Threads: Win32 / Posix

There are two major threading models to choose from:

  • win32 threads will not give you C++11 multithreading features.
  • posix threads enable C++11 multithreading features. It will make your resulting executable depend on your compiler's libwinpthreads included Dynamic Link Library. As a result you will have to distribute that library with your executable. If you want to use standard C++11 threading then choose posix.

Using one threading model or the other is not mutually exclusive, you can directly call each others API regardless of which model your compiler uses.

Exceptions: Dwarf / Long Jump Short Jump / Structured Exception Handling

There are three major exception models to choose from:

  • Dwarf exceptions are very fast, but if your exceptions have to pass through Windows APIs/code then you could have issues. If your project is basically self-contained and you do not expect to throw or receive exceptions through Windows APIs then it is a good 32-bit compiler choice. Dwarf exceptions are not available on 64-bit compilers.
  • LJSJ exceptions can travel through Windows APIs/code. They don't propagate through your code as fast as Dwarf exceptions do but they have the ability to pass through Windows APIs/code. If you need your exceptions to pass through Windows code on a 32-bit system then LJSJ is a good choice.
  • SEH exceptions are very fast but only available on 64-bit compilers and not 32-bit ones because of a software patent. The software patent applies specifically to 32-bit compilers, not 64-bit ones, so SEH is only available royalty-free with a 64-bit compiler. SEH exceptions are both fast and can travel through Windows APIs/code. If you are developing with a 64-bit compiler then you should use SEH.

TDM-GCC

The fastest way to set up a working compiler is to install a recent GCC release targeting the MinGW compiler system from TDM-GCC. The Code::Blocks team recommends TDM builds of MinGW.

Installation

Download the on-demand installer and run it.

Go through the installation pages, the red arrows are all the default options which we will be keeping and the last blue arrow is to indicate that you will be putting TDM-GCC into your system's PATH. This is important because it means that during development the compiler libraries will be accessible by default to your programs as you develop them and also makes it easier to use utilities such as CMake as they will be able to find your compiler toolchain. When you actually distribute your programs to other computers then you will copy the needed Dynamic Link Libraries out of your TDM folder and include them as part of your installer. On your machine they are in your PATH so you always have them, on your users computers the won't have the compiler toolchain so there you provide the .dll files with your program.

TDM Create.png TDM Arch.png

TDM Inst Dir.png TDM Inst Options.png

Once you are ready, click Install to proceed.

Code::Blocks Configuration

Go to your Compiler settings:

Compiler Settings.png

And then under the "Toolchain executables" tab (red arrow), click on the ellipsis ("...", blue arrow) and choose the root directory where you installed TDM-GCC 32-bit. Once you have that directory chosen, in the "Program Files" (green arrow) area fill out the fields as shown. If you choose the blue arrow ellipsis first then for each ellipsis you click on under "Program Files" you will already be in your TDM-GCC bin folder where the actual programs are.

CB TDM Toolchain.png

Now, go to your Debugger settings:

Settings Debugger.png

Choose your default debugger (red arrow), and then fill in the Executable path for it as shown for TDM-GCC 32-bit (blue arrow).

Debugger Default.png

Summary

You now have a Code::Blocks environment that is configured to use TDM-GCC 32-bit properly. Using this as a template you can easily set up alternative compilers no matter the source - just follow the same basic procedure.

Other MinGW links

Unofficial MinGW package From Equation.com

MinGW-Builds

Development Tools

UnxUtils

Ports of the most often used Unix utilities. Note that some tools in UnxUtils are quite a bit outdated, so make sure you do not overwrite already existing MinGW files with their UnxUtils counterparts.

GnuWin32

More recent versions of commonly used Unix utilities. Also: utilities not found in UnxUtils at all.

Dependencies: