INSTALLING 64-BIT AND 32-BIT GCC 8.3 EXECUTABLES THAT CAN COMPILE TO 64-BIT AND 32-BIT CODE,
RESPECTIVELY (MY FOLDER STRUCTURE).
It appears that the Mingw64 team is not as committed to the automated builds, as they have
not posted an update to the personal builds folder since May 2018. (I started a sourceforge
discussion thread on the topic which offers some explanations. So I used a different
build this time for gcc 8.3. This distribution takes up about 475 MiB of disk space.
Apr 4, 2019 (last updated Sep 10, 2019)
-----------
1. Download this distro:
a. x86_64-w64-mingw32-8.3.0-crt-6.0.0-multilib.7z
Folder: Ray Linn's gcc 8.x builds
(available from http://sourceforge.net/projects/mingw-w64)
2. Extract the distro under a root folder like "d:\mingw"
3. Move to d:\mingw (or whatever the intall folder is) and run the gosetup.bat script
from that folder. Make sure make.exe, rsxnt.dll, and floatmod.exe are in d:\mingw
before running the script if you want those files (floatmod.exe is required for the
script to run successfully).
The install script will create a directory structure like so:
d:\mingw
+- include (from \mingw\include and \mingw\x86_64-w64-mingw32\include)
+- libexec (from \mingw\libexec)
+- lib64 (from \mingw\lib and \mingw\x86_64-w64-mingw32\lib)
+- lib32 (from \mingw\x86_64-w64-mingw32\lib32)
+- bin (from \mingw\bin and \mingw\x86_64-w64-mingw32\bin)
4. 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
5. Script mingw.bat to set environment/path. Usage: mingw 64 or mingw 32
@echo off
if not "%1"=="" goto envset
echo "Usage: mingw 32|64"
goto end
:envset
set MINGW=d:\mingw
set MYINCLUDE=d:\my_include
set MYLIB=d:\my_libs\mingw%1
set GCCVER=8.3.0
rem
rem Remove all other C compilers from path. You can remove the -u swithces
rem if you are not using any other C compilers. Change the drive letters to
rem match yuor system
rem
repath -u c:\tcc* -u *\Intel\Composer* -u *Visual* -u *watcom* -u c:\mingw* -u d:\mingw* -e %MINGW%\bin
call _repath.bat
del _repath.bat
set c_include_dir=%MYINCLUDE%
set c_include_path=%MYINCLUDE%;%MINGW%\include\x64;%MINGW%\include;%MINGW%\include\ddk
set cplus_include_path=%MYINCLUDE%;%MINGW%\include\c++\x%1;%MINGW%\include\c++;%MINGW%\include\c++\backward;%MINGW%\include\x64;%MINGW%\include
set library_path=%MYLIB%;%MINGW%\lib%1
set libdir=
set exedir=c:\bin%1
set cc=gcc
set cpp=g++
set f77=gcc
set cflags=-Ofast -m%1 -Wall
gcc -v
:end