Merge branch 'pthreads' of git://repo.or.cz/msysgit into devel
[msysgit.git] / mingw / README-gcc-tdm.txt
blob7d95baeee820ed05148424cc0ec895696b3f28c4
1 ===== TDM's Experimental GCC/MinGW32 Builds =====\r
2 \r
3 NOTICE:\r
4 TDM-GCC is an unofficial replacement for the official GCC binaries distributed\r
5 by the MinGW project; please note the following caveats:\r
6  * TDM-GCC is not formally affiliated with or endorsed by the MinGW project\r
7     (although several MinGW team members make use of it)\r
8  * No level of support for TDM-GCC is in any way guaranteed (although a best\r
9     effor is made to fix bugs as they are found or forward them to GCC Bugzilla)\r
11 BUGS:\r
12 If you encounter a problem while using a TDM-GCC build that isn't present in a\r
13 previous MinGW or TDM release, you are encouraged to submit a helpful bug\r
14 report. Please see <http://www.tdragon.net/recentgcc/bugs.php> for further\r
15 instructions.\r
18 >>>>> INSTALLATION\r
20 *** TDM/MinGW Installer ***\r
22 Using the TDM/MinGW installer is highly recommended; it can automatically\r
23 install TDM-GCC (or the official MinGW GCC) as well as all supplementary MinGW\r
24 base system packages. The installer uses a standard wizard interface with\r
25 reasonable defaults.\r
27 *** Manual Installation ***\r
29 These binary packages are designed as drop-in replacements for the MinGW\r
30 project's official gcc packages. When using these packages, you are encouraged\r
31 to start with a clean slate and install only the MinGW packages which are\r
32 necessary to you. You'll need the following packages for basic Windows\r
33 development:\r
34  * binutils (binutils-2.19.1-mingw32-bin.tar.gz)\r
35  * mingw-runtime (mingwrt-3.15.2-mingw32-dev.tar.gz,\r
36      mingwrt-3.15.2-mingw32-dll.tar.gz)\r
37  * w32api (w32api-3.13-mingw32-dev.tar.gz)\r
38 You might also want to install: \r
39  * mingw-utils (mingw-utils-0.3.tar.gz)\r
40  * mingw32-make (mingw32-make-3.81-20080326-3.tar.gz)\r
41  * gdb (gdb-6.8-mingw-3.tar.bz2)\r
42 You'll need GDB particularly if you want to use an IDE with debugging support.\r
44 Decide whether to use the SJLJ or DW2 (Dwarf-2) exception model. Then, for the\r
45 exception model of your choice, download at least the "core" TDM-GCC package,\r
46 which includes the required base files as well as support for the C language.\r
47 You can also download any or all of the other TDM-GCC packages, depending on\r
48 which of GCC's supported languages you'd like to use.\r
50 Extract the MinGW packages to an empty directory -- typically C:\MinGW. Then,\r
51 extract the TDM-GCC package(s) and choose to overwrite any duplicate files that\r
52 may exist. Finally, consider adding the bin directory to your Windows PATH\r
53 environment variable.\r
56 >>>>> USAGE NOTES\r
58 *** Dwarf-2 vs. SJLJ unwinding ***\r
60 GCC supports two methods of stack frame unwinding: Dwarf-2 (DW2) or SJLJ\r
61 (setjmp/longjmp). Until recently, only SJLJ has been available for the Windows\r
62 platform. This affects you, the end user, primarily in programs that throw and\r
63 catch exceptions. Programs which utilize the DW2 unwind method handle exceptions\r
64 much more quickly than programs which utilize the SJLJ method. However, the DW2\r
65 method increases code size by a noticeable amount, and additionally cannot yet\r
66 unwind (pass exceptions) through "foreign" stack frames: stack frames compiled\r
67 by another non-DW2-enabled compiler, such as OS DLLs in a Windows callback.\r
69 This means that you should in general choose the SJLJ version of the TDM-GCC\r
70 builds unless you know you need faster exception handling and can be certain you\r
71 will never throw an exception through a foreign stack area.\r
73 As distributed, the SJLJ and DW2 packages of TDM-GCC can coexist peacefully\r
74 extracted to the same directory (e.g. any files in common are for all intents\r
75 and purposes identical), because the driver executables (the ones in the "bin"\r
76 directory) are suffixed with "-dw2" for the DW2 build, and the libraries and\r
77 other executables hide in another "-dw2" directory in "lib(exec)/gcc/mingw32".\r
78 This allows you to use the same single addition to your PATH, and use DW2\r
79 exceptions only when you need them by calling "gcc-dw2", etc. If you truly want\r
80 DW2 exceptions as the default when calling "gcc" (from Makefiles or configury\r
81 systems, for example), you can rename or copy the suffixed executables to their\r
82 original names.\r
84 TDM releases from the GCC 4.2 series use the SJLJ unwind method.\r
86 *** Exceptions and DLLs ***\r
88 The TDM-2 release of GCC 4.3.0 incorporated experimental builds of libgcc and\r
89 libstdc++ as DLLs in order to allow exceptions to be thrown out of DLLs. With\r
90 the more recent releases this has been dropped in favor of a ported version of\r
91 3.4.5's shared memory patch, because of various problems encountered in the DLL\r
92 versions. (Once these problems are solved, the DLL versions will be included\r
93 again.)\r
95 Therefore, you no longer need to add any additional command-line options to\r
96 throw exceptions out of a DLL. You should, however, still add "-mthreads" to the\r
97 command line any time you throw exceptions in a multi-threading context.\r
99 The ported exceptions/DLLs patch is experimental and has only received limited\r
100 testing, so please report any bugs you encounter in throwing exceptions that are\r
101 not present in the official MinGW 3.4.5 release.\r
103 TDM releases from the GCC 4.2 series cannot yet throw exceptions out of DLLs.\r
105 *** OpenMP and pthreads-w32 ***\r
107 The core binary package has been built to allow the use of GCC's "-fopenmp"\r
108 option for generating parallel code as specified by the OpenMP API. (See\r
109 <http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/C-Dialect-Options.html#index-fopenmp-109>\r
110 for details.)\r
112 The OpenMP support in the TDM-GCC builds has received very little testing; if\r
113 you find build or packaging problems, please send a bug report (see BUGS above).\r
115 LibGOMP, GCC's implementation of OpenMP, currently only supports the use of the\r
116 POSIX Threads (pthreads) api for implementing its threading model. Because the\r
117 MinGW project itself doesn't distribute a pthreads implementation, the\r
118 "pthreads-win32" library, available from http://sourceware.org/pthreads-win32/,\r
119 is included in this distribution. If you aren't familiar with pthreads-win32,\r
120 please read the file "pthreads-win32-README" for more information, or the\r
121 documentation available at the website referenced above. pthreads-win32 is\r
122 distributed under the terms of the LGPL; see "COPYING.lib-gcc-tdm.txt" for\r
123 details.\r
125 In order to correctly compile code that utilizes OpenMP/libGOMP, you need to add\r
126 the "-fopenmp" option at compile time AND link time, and link to libgomp.a and\r
127 libpthread.a at link time ("-lgomp -lpthread"). By default, libpthread.a links\r
128 the standard C-cleanup DLL version of pthreads-win32 to your program, which\r
129 means that you will need to ensure that the file "pthreadGC2.dll" (included in\r
130 the "bin" subdirectory of this package) can be found by your program. If you\r
131 plan to distribute a program that relies on pthreads-win32, be sure to\r
132 understand and comply with the terms of the LGPL (see COPYING.lib-gcc-tdm.txt).\r
134 "libpthread.a" is included in the "lib/gcc/mingw32/4.3.2[-dw2]" subdirectory of\r
135 this package along with two other pthreads library files:\r
136  - "libpthreadGC2-static.a" provides a static version of the pthreads-win32\r
137      library, but it requires some additional non-POSIX-compliant startup code\r
138      to be included in your program. See "pthreads-win32-README" for\r
139      details.\r
140  - "libpthreadGCE2.a" provides a version of the pthreads-win32 library with\r
141      a somewhat safer response in the face of unexpected C++ exceptions.\r
142      The creators of the pthreads-win32 library recommend, however, that this\r
143      version not be used, because code written to rely on this is less portable.\r
145 *** Warnings and errors ***\r
147 GCC 4 represents a significant step forward in optimization capabilities, error\r
148 detection, and standards compliance, and this is more true than ever with the\r
149 advent of the 4.3 release series. For you, the end user, this will mean that\r
150 code which used to compile and run without problems will almost certainly\r
151 exhibit some warnings and maybe even a few errors.\r
153 These meaningful warnings and errors are a very good thing, as they help the\r
154 programmer to write safer and more correct code. Unfortunately, there's also a\r
155 chance you might encounter incorrect warnings or errors, ICE's (internal\r
156 compiler errors, where the compiler makes a mistake and has to bail out), or\r
157 even miscompilations (where your code is incorrectly compiled and produces the\r
158 wrong result).\r
160 If you encounter an ICE while using a TDM-GCC build, feel free to file a bug\r
161 report (see BUGS above). With any other unexpected problem, you are urged to\r
162 work from the assumption that it stems from user error, and ensure that your\r
163 code is correct and standards-compliant. \r
166 >>>>> BUGS AND KNOWN ISSUES\r
168  * [4.3 series only] Under rare and as-yet-unidentified circumstances, inclusion\r
169      of a precompiled header will cause compilation to fail with an error like\r
170      "error: calling fdopen: bad file descriptor or file name". It seems only to\r
171      happen when the PCH is double-included by both an #include directive and\r
172      the -include command-line switch, but this in itself will not trigger the\r
173      bug.\r
174  * [4.1 and 4.2 series only] Exceptions cannot leave DLLs. Recent TDM\r
175      releases from the 4.3 series do not have this problem. It only appears in\r
176      previous releases when a function in a DLL called from outside the DLL\r
177      throws (or fails to catch) an exception, and results in program termination\r
178      at that point.\r
179  * [4.2 series only] A miscompilation can occur in very specific situations when\r
180      -O2 optimization is enabled, if you pass the address of a local pointer\r
181      variable to a function that modifies it. Use "-O2 -fno-strict-aliasing" as\r
182      a workaround. This has been fixed as of the 4.3 series. (See\r
183      <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328>.)\r
185 As these builds are provided on the same basis as the source releases, and the\r
186 mingw32 target in GCC tends to receive somewhat less-than-average attention,\r
187 some bugs are expected. If you encounter a bug that you are certain is in the\r
188 GCC sources (such as an ICE), or that is due to an issue in the building or\r
189 packaging process, you are encouraged to report it. Please visit the TDM-GCC\r
190 Bugs Page at <http://www.tdragon.net/recentgcc/bugs.php> for bug reporting\r
191 instructions.\r
194 >>>>> LOCAL FIXES AND CHANGES\r
196  - [4.3 series] Includes a patch ported from the official MinGW 3.4.5 release to\r
197      propagate exceptions out of DLLs without the need for shared versions of\r
198      libgcc and libstdc++.\r
199  - [4.3 series] Includes a patch which corrects backslash usage in header paths\r
200       and fixes path problems when debugging. (See\r
201       http://sourceforge.net/tracker2/?func=detail&aid=2145427&group_id=200665&atid=974439)\r
202  - Includes a patch to fix a crash when all temporary directory environment\r
203       variables are empty.\r
204  - Includes a patch to keep GCC from erroneously using the CWD as the\r
205      installation directory.\r
206  - Configured with "--enable-fully-dynamic-string", which fixes a bug when\r
207      passing empty std::string objects between DLLs and EXEs.\r
209 [The following patches are only necessary for the 4.2 series and have been\r
210 applied in the 4.3 sources]\r
212  - Includes a patch which fixes GCC bug #27067. The primary reason for including\r
213      this patch was to let the wxWidgets GUI library compile successfully\r
214      out-of-the-box. (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27067)\r
215  - Includes a patch to remove a dependency on the runtime for the classic ctype\r
216      table, moving it to libstdc++ itself. (See\r
217      http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01413.html)\r
218  - Includes a patch to fix an ICE when compiling gettext (See\r
219      http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29826)\r
222 >>>>> SOURCE CODE\r
224 The source code for the TDM-GCC binary releases is available from the TDM-GCC\r
225 download page on SourceForge:\r
226 <http://sourceforge.net/project/showfiles.php?group_id=200665>\r
227 (The most up-to-date link to the download site will always be available at\r
228 <http://www.tdragon.net/recentgcc/>.\r
230 The source is distributed in the form of the original ("vanilla") separate\r
231 source packages as downloaded, plus an additional "TDM Sources" package. The TDM\r
232 Sources package includes unified diffs of any changes made to the vanilla\r
233 sources, as well as the set of scripts used to build the binary releases.\r
236 >>>>> LICENSE\r
238 The TDM-GCC packages contain binary distributions constituting a work based on\r
239 GCC, which is licensed under the GPL. For further details, refer to the file\r
240 "COPYING-gcc-tdm.txt" within the downloaded package. Additionally, TDM-GCC\r
241 contains binary files constituting works based on libiconv, GMP, MPFR, and\r
242 pthreads-w32, all of which are licensed under the LGPL; COPYING.lib-gcc-tdm.txt\r
243 contains a copy of the LGPL.\r
245 The TDM-GCC distribution is free software; you can redistribute it and/or modify\r
246 it under the terms of the GNU General Public License as published by the Free\r
247 Software Foundation; either version 3 of the License, or (at your option) any\r
248 later version.\r
250 TDM-GCC is distributed in the hope that it will be useful, but WITHOUT ANY\r
251 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\r
252 PARTICULAR PURPOSE. See the GNU General Public License for more details.\r
254 You should have received a copy of the GNU General Public License along with\r
255 this program. If not, see <http://www.gnu.org/licenses/>.\r