INSTALLING 64-BIT AND 32-BIT GCC 13.2.0-3 EXECUTABLES THAT CAN COMPILE TO 64-BIT AND 32-BIT
MS WINDOWS CODE, RESPECTIVELY (MY FOLDER STRUCTURE).
------------
Dec 25, 2023
------------
BUILD MINGW-64 GCC YOURSELF!
----------------------------
Here is my latest build script if you want to try it yourself. Be warned that on a pretty
fast system (core i9-9900 with SSD's), the build takes about 4 hours (2 hours for the 64-bit
exe's and 2 hours for the 32-bit exes). It also requires several GB of disk space. You'll
need my imerge.exe and imerge2.ese programs to get rid of redundant system include files.
My favorite version of make.exe is included in this distro--admittedly it is antiquated:
make.exe and rsxnt.dll.
Note that the ar program needs the -U option to store file dates.
MSYS-2 repository: repo.msys2.org/mingw/x86_64/
(You can check what the latest archived version of gcc is here.)
The build of gcc is a long process with multiple passes. In each subsequent pass, the
compiler is re-built using the version that was just compiled. Here is a summary
of what happens during the gcc build process.
== OR ==
SKIP THE BUILD--JUST DOWNLOAD THE PRE-BUILT PACKAGE
---------------------------------------------------
You don't have to build your own if you just want to download my build directly. My
goal is to have a minimalistic, straightforward folder structure that I use to compile
all my C/C++ code. This distro also includes pthreads, ada, objective C, Fortran 95.
+-----------------------------------------------------------+
| 1. Download my gcc 13.2.0-3 distro (128 MB .7z file). |
+-----------------------------------------------------------+
2. This package will extract to its own subfolder, mingw64_gcc13.2.0-3_willus.com, so I
install from the root folder of D:\ like so:
d:\mingw64_gcc13.2.0-3_willus.com
+- include
+- lib
+- x64
+- x32
+- bin
+- x64
+- x32
+- lib
3. Script mingw.bat to set environment/path. Usage: mingw 64 or mingw 32
@echo off
if not "%1"=="" goto checkarg
echo "Usage: mingw 32|64"
goto end
:checkarg
if "%1"=="32g" goto set32g
if "%1"=="32" goto set32
set BITS=64
set cflagsxtra=-m64
rem If you do not use wmake, you can leave this out
set WMAKE_ENV=env_mswin.txt
goto :envset
:set32
set BITS=32
set cflagsxtra=-m32
rem If you do not use wmake, you can leave this out
set WMAKE_ENV=env_mswin.txt
goto :envset
:set32g
set BITS=32
set cflagsxtra=-m32 -mtune=generic -march=i486
rem If you do not use wmake, you can leave this out
set WMAKE_ENV=
:envset
set MINGW=d:\mingw64_gcc13.2.0-3_willus.com
set MYINCLUDE=d:\my_include
set MYLIB=d:\my_lib\mingw%1
set GCCVER=13.2.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 your system
rem
repath -u c:\llvm* -u d:\llvm* -u c:\mingw* -u d:\mingw* -e %MINGW%\bin\x%BITS%
call _repath.bat
del _repath.bat
set c_include_dir=%MYINCLUDE%
set c_include_path=%MYINCLUDE%;%MINGW%\include\x%BITS%;%MINGW%\include;%MINGW%\include\ddk
set cplus_include_path=%MYINCLUDE%;%MINGW%\include\x%BITS%\c++;%MINGW%\include\c++;%MINGW%\include\c++\backward;%MINGW%\include\x%BITS%;%MINGW%\include
set library_path=%MYLIB%;%MINGW%\lib\x%BITS%
set libdir=
set exedir=c:\bin%BITS%
set cc=gcc
set cpp=g++
set f77=gcc
set cflags=-Ofast -Wall %cflagsxtra%
set BITS=
set cflagsxtra=
gcc -v
:end