TDM's Experimental GCC/MinGW32 Builds
Binary packages of recent GCC releases targeting the MinGW compiler system
Main Page | Development Information | Bugs
Last updated: 2008-06-26 12:21
in a nutshell
The TDM-GCC builds are unofficially created packages designed to replace, for
experimentation purposes, the official MinGW releases of GCC binaries. The
TDM-GCC builds typically contain fewer changes from the vanilla sources and
receive less testing than their official counterparts. Since these builds are
not formally affiliated with or endorsed by the MinGW project, they should be
treated as unstable and unsupported software -- in other words, use it at your
own risk.download
| Release | Download | |||
|---|---|---|---|---|
| GCC 4.3.1-tdm-1 Released 2008-06-26 |
Package | SJLJ Unwinding | OR | Dwarf-2 Unwinding |
| core (Required base files and C support) |
[tar.gz] (5.42 MB) or [zip] (5.20 MB) | [tar.gz] (5.44 MB) or [zip] (5.23 MB) | ||
| ada (Ada support) |
[tar.gz] (20.2 MB) or [zip] (20.6 MB) | [tar.gz] (20.5 MB) or [zip] (20.9 MB) | ||
| g++ (C++ support) |
[tar.gz] (5.34 MB) or [zip] (5.82 MB) | [tar.gz] (5.34 MB) or [zip] (5.82 MB) | ||
| fortran (Fortran support) |
[tar.gz] (4.09 MB) or [zip] (3.92 MB) | [tar.gz] (4.09 MB) or [zip] (3.92 MB) | ||
| objc (Objective-C support) |
[tar.gz] (3.48 MB) or [zip] (3.34 MB) | [tar.gz] (3.48 MB) or [zip] (3.34 MB) | ||
| objc++ (Objective-C++ support) |
[tar.gz] (3.69 MB) or [zip] (3.53 MB) | [tar.gz] (3.69 MB) or [zip] (3.53 MB) | ||
| GCC 4.2.4-tdm-1 Released 2008-06-09 |
Package | SJLJ Unwinding | OR | Dwarf-2 Unwinding |
| core (Required base files and C support) |
[tar.gz] (5.13 MB) or [zip] (4.93 MB) | |||
| ada (Ada support) |
[tar.gz] (19.9 MB) or [zip] (20.1 MB) | |||
| g++ (C++ support) |
[tar.gz] (4.54 MB) or [zip] (4.97 MB) | |||
| fortran (Fortran support) |
[tar.gz] (3.49 MB) or [zip] (3.34 MB) | |||
| objc (Objective-C support) |
[tar.gz] (2.88 MB) or [zip] (2.77 MB) | |||
| objc++ (Objective-C++ support) |
[tar.gz] (3.06 MB) or [zip] (2.94 MB) | |||
|
For previous releases and source code, see the
TDM-GCC download page
on SourceForge.
|
||||
GCC is supposed to support language XYZ! Why isn't there a language pack
available for it?
See the development page for details on languages that don't currently compile -- maybe you can provide a patch or alternate build command so that they can!
See the development page for details on languages that don't currently compile -- maybe you can provide a patch or alternate build command so that they can!
installation
These binary packages are designed as drop-in replacements for the
MinGW project's official gcc packages. When
using these packages, you are encouraged to start with a clean slate and install
only the MinGW packages which are necessary to you. At a minimum for basic
Windows development, you'll need the following packages:
- binutils (binutils-2.18.50-20080109-2.tar.gz, 5.81MB)
- mingw-runtime (mingw-runtime-3.14.tar.gz, 494KB)
- w32api (w32api-3.11.tar.gz, 1.55MB)
- mingw-utils (mingw-utils-0.3.tar.gz, 1.51MB)
- mingw32-make (mingw32-make-3.81-2.tar.gz, 95KB)
- gdb (gdb-6.8-mingw-3.tar.bz2, 1.99MB)
Decide whether to use the SJLJ or DW2 (Dwarf-2) exception model. As a general rule, you should choose the default SJLJ packages, unless you know you need faster exception handling and can guarantee you'll never need to unwind through non-DW2-compiled stack frames (such as a Windows callback). Then, for the exception model of your choice, download at least the "core" TDM-GCC package, which includes the required base files as well as support for the C language. You can also download any or all of the other TDM-GCC packages, depending on which of GCC's supported languages you'd like to use.
Extract the MinGW packages to an empty directory -- typically C:\MinGW. Then, extract the TDM-GCC package(s) and choose to overwrite any duplicate files that may exist. If you chose to use the "dw2" TDM-GCC packages, consider removing the "-dw2" suffix from the program names; see the README file or the usage notes for further details. Finally, consider adding the bin directory to your Windows PATH environment variable.
You can browse all released packages and source packages at the TDM-GCC download page on SourceForge. Beginning with the 4.3.0 release, all TDM-GCC releases are now available as gzipped tarballs or zip archives. Previous releases require 7-Zip for unarchiving.
All-in-One Installer:
Giovanni Bajo created an "all-in-one" user-friendly installer of an earlier 4.1.2 GCC-TDM release, which additionally features full Python integration. The full installer is available at http://www.develer.com/oss/GccWinBinaries.
usage notes
Exceptions and DLLs:The TDM-2 release of GCC 4.3.0 incorporated experimental builds of libgcc and libstdc++ as DLLs in order to allow exceptions to be thrown out of DLLs. With the more recent releases this has been dropped in favor of a ported version of 3.4.5's shared memory patch, because of various problems encountered in the DLL versions. (Once these problems are solved, the DLL versions will be included again.)
Therefore, you no longer need to add any additional command-line options to throw exceptions out of a DLL. You should, however, still add "-mthreads" to the command line any time you throw exceptions in a multi-threading context.
The ported exceptions/DLLs patch is experimental and has only received limited testing, so please report any bugs you encounter in throwing exceptions that are not present in the official MinGW 3.4.5 release.
TDM releases from the GCC 4.2 series cannot yet throw exceptions out of DLLs.
Dwarf-2 vs. SJLJ unwinding:
GCC supports two methods of stack frame unwinding: Dwarf-2 (DW2) or SJLJ (setjmp/longjmp). Until recently, only SJLJ has been available for the Windows platform. This affects you, the end user, primarily in programs that throw and catch exceptions. Programs which utilize the DW2 unwind method handle exceptions much more quickly than programs which utilize the SJLJ method. However, the DW2 method increases code size by a noticeable amount, and additionally cannot yet unwind (pass exceptions) through "foreign" stack frames: stack frames compiled by another non-DW2-enabled compiler, such as OS DLLs in a Windows callback.
This means that you should in general choose the SJLJ version of the TDM-GCC builds unless you know you need faster exception handling and can be certain you will never throw an exception through a foreign stack area.
As distributed, the SJLJ and DW2 packages of TDM-GCC can coexist peacefully extracted to the same directory (e.g. any files in common are for all intents and purposes identical), because the driver executables (the ones in the "bin" directory) are suffixed with "-dw2" for the DW2 build, and the libraries and other executables hide in another "-dw2" directory in "lib(exec)/gcc/mingw32". This allows you to use the same single addition to your PATH, and use DW2 exceptions only when you need them by calling "gcc-dw2", etc. If you truly want DW2 exceptions as the default when calling "gcc" (from Makefiles or configury systems, for example), you can rename or copy the suffixed executables to their original names.
TDM releases from the GCC 4.2 series use the SJLJ unwind method.
Warnings and errors:
GCC 4 represents a significant step forward in optimization capabilities, error detection, and standards compliance, and this is more true than ever with the advent of the 4.3 release series. For you, the end user, this will mean that code which used to compile and run without problems will almost certainly exhibit some warnings and maybe even a few errors.
These meaningful warnings and errors are a very good thing, as they help the programmer to write safer and more correct code. Unfortunately, there's also a chance you might encounter incorrect warnings or errors, ICE's (internal compiler errors, where the compiler makes a mistake and has to bail out), or even miscompilations (where your code is incorrectly compiled and produces the wrong result).
If you encounter an ICE while using a TDM-GCC build, feel free to file a bug report (see the Bugs page). With any other unexpected problem, you are urged to work from the assumption that it stems from user error, and ensure that your code is correct and standards-compliant.
OpenMP and pthreads-w32:
The TDM-GCC releases include support for OpenMP. Be sure to read the file README-gcc-tdm.txt, included in the core package, for usage notes on this topic.
Local Fixes and Changes:
See the Development page for information on patches to the vanilla sources included in the TDM-GCC releases.
bugs and known issues
- [4.3 series only] Under rare and as-yet-unidentified circumstances, inclusion of a precompiled header will cause compilation to fail with an error like "error: calling fdopen: bad file descriptor or file name". It seems only to happen when the PCH is double-included by both an #include directive and the -include command-line switch.
- [4.1 series, 4.2 series, and 4.3.0-tdm-1] Exceptions cannot leave DLLs. This issue was fixed in the official MinGW releases with local patches for the 3.4 series and 4.2 series, but is not fixed in the main GCC sources. In 4.3.0-tdm-2, this can be solved by linking with the shared versions of libgcc and libstdc++; in 4.3.0-tdm-3 and later releases, this is no longer necessary and it should work in the same way as the official MinGW 3.4.5 release. The problem only appears in previous releases when a function in a DLL called from outside the DLL throws (or fails to catch) an exception, and results in program termination at that point.
- [4.2 series only] A miscompilation can occur in very specific situations when -O2 optimization is enabled, if you pass the address of a local pointer variable to a function that modifies it. Use "-O2 -fno-strict-aliasing" as a workaround. This has been fixed as of the 4.3 series. (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328)
source code
The source code for the TDM-GCC binary releases is available from the
TDM-GCC download page
on SourceForge. It is distributed in the form of the original ("vanilla")
separate source packages as downloaded, plus an additional "TDM Sources"
package. The TDM Sources package includes unified diffs of any changes made to
the vanilla sources, as well as the set of scripts used to build the binary
releases.license
The TDM-GCC packages contain binary distributions constituting a work based on
GCC, which is licensed under the GPL. For further details, refer to the file
"COPYING-gcc-tdm.txt" within the downloaded package. Additionally, TDM-GCC
contains binary files constituting works based on libiconv, GMP, MPFR, and
pthreads-w32, all of which are licensed under the LGPL; COPYING.lib-gcc-tdm.txt
contains a copy of the LGPL.The TDM-GCC distribution is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
TDM-GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
