INSTALLING 64-BIT AND 32-BIT GCC 4.6.3 EXECUTABLES THAT CAN COMPILE TO 64-BIT AND 32-BIT CODE, RESPECTIVELY. Note: You can simply install the two distros below separately. This is by far the simplest solution. I combined them to save ~40 MiB disk space due to elimination of redundant include files and also to have a more elegant directory structure. If you want to combine them, my steps on how I did it are below. A big thank you to Ruben Vandamme (rubenv at Sourceforge.net). Dec 28, 2011 ------------ 1. Combined these two distros: a. i686-w64-mingw32-gcc-4.6.3-1_rubenvb.7z b. x86_64-w64-mingw32-gcc-4.6.3-1_rubenvb.7z (available from http://sourceforge.net/projects/mingw-w64) 2. Tree structure: d:\mingw +- share (from \mingw64\share--see note 3.) +- licenses (from \mingw64\licenses--see note 3.) +- include (from \mingw64\include--see note 4.) +- i386 +- libexec (from \mingw32\libexec) +- lib (from \mingw32\lib) +- bin (from \mingw32\bin) +- x64 +- libexec (from \mingw64\libexec) +- lib (from \mingw64\lib) +- bin (from \mingw64\bin) 3. Share and licenses folder in both distros exactly the same, so juse use the one from x64. 4. Include folders are identical except; a. copy the folder \mingw32\include\c++\4.6.3\i686-w64-mingw32 into the mingw64 b. Added two #ifdef __x86_64's into bfd.h (see bfd.h). [Used diffdir.exe program to figure this out.] c. Moved include\c++\4.6.3\* to include\c++ d. Modified the c++config.h in include\c++\x86_64-w64-mingw32\bits to ifdef x86_64 and then moved all those bits files to include\c++\bits and removed include\c++\i686-w64-mingw32 (or whatever folder had the 32-bit bits folder). There is a file called x86_64-w64-mingw32_bits_list.txt in include\c++\bits which shows what files used to be divided between the two different architecture's bits folders. Again, I used diffdir to determine that all bits files but c++config.h were the same between the two architectures. e. Must manually put include\c++ and include\c++\backward in your c++ include path. f. Commented out #include_nextat the bottom of float.h in the two architecture include folders (e.g. i386\lib\gcc\i686-w64-mingw32\4.6.3\include). 5. (Optional) Create subfolder "dontuse" in the lib dirs (\mingw\x64\lib and \mingw\i386\lib) and move *dll* to these subfolders so that no dll dependencies are created when you build your exes. 6. Add make.exe and rsxnt.dll to d:\mingw\i386\bin and d:\mingw\x64\bin since I like them. 7. Optimizations a. One-pass max: -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer -fgraphite-identity -floop-interchange -floop-block -floop-parallelize-all -ftree-loop-distribution -ftree-parallelize-loops=2 -pthread -m64 -Wall b. Profile generate: -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer -fgraphite-identity -floop-interchange -floop-block -pthread -floop-parallelize-all -ftree-parallelize-loops=4 -ftree-loop-distribution -march=native -m64 -Wall -fprofile-generate=d:\gcc_profiles c. Profile use: -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer -fgraphite-identity -floop-interchange -floop-block -pthread -floop-parallelize-all -ftree-parallelize-loops=4 -ftree-loop-distribution -march=native -m64 -Wall -fprofile-use=d:\gcc_profiles 8. Scripts to set environment/path: a. 64-bit: @echo off call goclear.bat (removes all other compiler dirs from path) call _repath.bat del _repath.bat repath -e d:\mingw*\x64\bin repath -e d:\mingw\x64\bin call _repath.bat del _repath.bat set c_include_path=s:\include;d:\mingw\include set cplus_include_path=s:\include;d:\mingw\include;d:\mingw\include\c++;d:\mingw\include\c++\backward set library_path=d:\will\custom\mingw64;d:\mingw\x64\lib set libdir= set exedir=d:\bin64 set cc=gcc set cpp=g++ set f77=gcc set cflags=-Ofast -m64 -Wall gcc -v b. 32-bit: @echo off call goclear.bat (removes all other compiler dirs from path) call _repath.bat del _repath.bat repath -e d:\mingw*\i386\bin call _repath.bat del _repath.bat set c_include_path=s:\include;d:\mingw\include set cplus_include_path=s:\include;d:\mingw\include;d:\mingw\include\c++;d:\mingw\include\c++\backward set library_path=d:\will\custom\mingw;d:\mingw\i386\lib set libdir= set exedir=d:\bin set cc=gcc set cpp=g++ set f77=gcc set cflags=-Ofast -m32 -Wall gcc -v