forked from MNRK01/myGCCBuilds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcc mingw-w64 build instructions v2.txt
59 lines (58 loc) · 5.55 KB
/
gcc mingw-w64 build instructions v2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
1) Disable McAfee's (or any other antivirus) Real Time Scanning
2) Download msys2-base-x64_86-YYYYMMDD.tar.xz
3) Unpack it into <msys root dir>
4) Goto <msys root dir> and double click on msys2.exe, following the instructions on the screen
5) Run msys2.exe, run `pacman -Syuu` at the msys2 prompt until all the packages are updated
# {msys2-devel, mingw-w64-i686-toolchain, mingw-w64-x86_64-toolchain} install the necessary gcc later during the building process
6) `pacman -S base-devel vim`
# The next set of packages do not need to be installed until when Step 21 (./build --help) is run later
7) `pacman -S subversion zip p7zip sshpass dejagnu git`
8) `pacman -Scc` to clean up the install [optional]
9) `cd /home && mkdir arkay7777`
10) `export HOME=/home/arkay7777` to prevent gcc from being built in some alternate %HOME%
11) `echo $HOME` to test if $HOME is not some alternate %HOME%
12) `cd` into your new $HOME, verify location with `pwd`
# Use the DEVELOP branch and not the MASTER repository
13) `cd && git clone --branch develop https://github.com/niXman/mingw-builds.git`
# patch was built via `diff -ur --exclude=toolchains --exclude='*git*' mingw-builds-orig/ mingw-builds/ > '/path/to/gcc mingw-builds.patch'`
# use `patch --dry-run ...` to test if the patch applies first
14) `cd && patch -uN -p 1 --binary --dry-run --verbose -d mingw-builds/ < '/path/to/gcc mingw-builds.patch'`
15) `ls` to check if <mingw-builds> directory was created
16) `cd /` and `rm /MinGW` if it exists
17) `echo $PATH` to check that the $PATH is not contaminated with another gcc
18) `gcc -v` to also ensure no gcc is on the $PATH
19) `cd && cd mingw-builds`
20) Turn off the power (not display) settings for the computer so that it doesn't go to sleep during the build
21) `./build --help` to determine if (a) all necessary software is available (see Steps 6 and 7) and (b) options for building gcc
# choose `--mode=gcc-X.Y.Z --rt-version=vN` from the list generated
# the build process adds the following flags, among others on its own:
# --cppflags='', --cflags='-O2 -pipe -fno-ident', --cxxflags='-O2 -pipe -fno-ident', --ldflags='-pipe -fno-ident -Wl,--large-address-aware'
# adding --use-lto causes the build to crash with undefined references to rpl_printf(...) and related IO functions
# the use of --static-gcc is unnecessary and was used to try to unsuccessfully build with --use-lto
# building i686 multilib gcc will result in the building of certain i686 and x86_64 libs so always build the i686 gcc first
# building i686 multilib will download i686 and x86_64 gcc toolchains (e.g. i686-7.2.0-release-posix-sjlj-rt_v5-rev1.7z)
# into the mingw-builds\toolchains folder as the first step
# issue with mingw-w64 crt v. 7.0.0: need to add --cflags='<flags>', --cxxflags='<flags>', --ldflags='<flags>' as of mingw-w64 crt v7.0.0
# due to undefined references to __memcpy_chk and other stack protection functions. Apparently flags such as --ldflags='-lssp' (libssp.a)
# or, equivalently, --ldflags='-fstack-protector' should help by themselves but I found that they don't. Currently use --cflags until a
# fix is developed. See https://github.com/msys2/MINGW-packages/issues/5803 for details. Solved with mingw-w64 crt v7.
22) `./build --mode=gcc-10.1.0 --arch=i686 --threads=posix --exceptions=sjlj --enable-languages=c,c++,fortran --rt-version=v7 --jobs=4 --rev=0`
`./build --mode=gcc-10.1.0 --arch=i686 --threads=win32 --exceptions=sjlj --enable-languages=c,c++,fortran --rt-version=v7 --jobs=4 --rev=0`
`./build --mode=gcc-10.1.0 --arch=x86_64 --threads=posix --exceptions=seh --enable-languages=c,c++,fortran --rt-version=v7 --jobs=4 --rev=0`
`./build --mode=gcc-10.1.0 --arch=x86_64 --threads=win32 --exceptions=seh --enable-languages=c,c++,fortran --rt-version=v7 --jobs=4 --rev=0`
23) Wait for ~2-4 hours (i7-6600U) as each build finishes
24) Copy mingw-std-threads for the just-built gcc at path_to_gcc/opt/include/mingw-std-threads. See "mingw-std-threads install.sh" and
"mingw-std-threads build instructions v2.txt" for how to build these libraries ahead of time. Note that 2 versions need to be created - one
for i686 and the other for x86_64 builds. Also note that the auto-generated mingw-std-threads C++ headers have version information hardcoded
into the header and this needs to be edited prior to applying the patch described in "mingw-std-threads build instructions v2.txt".
25) Build boost using the just-built gcc. Change $PATH to use the just-built gcc for building these libraries.
See "boost build instructions v2.txt". Boost are placed in folders under /opt/include and /opt/lib
26) Turn on the power settings for the computer so that it goes to sleep after 20 minutes
27) Reactivate McAfee's Real Time Scanning
# use p7zip to compress archives. Find the directory (e.g. mingw-gcc-8.3.0\i686-830-posix-sjlj-rt_v6-rev0\) to compress mingwNN folder
# -tFormat -m0=Algorithm -mx=CompressionLevel (5 is default, 9 is max i.e. "ultra"), -mfb=# of Fast Bytes (i.e. Word Size),
# -md=Dictionary Size (32m=32 megabytes), -ms=Set Solid Mode
28) `7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on /c/Users/arkay7777/Desktop/i686-10.1.0-release-posix-sjlj-rt_v7-rev0.7z mingw32`
`7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on /c/Users/arkay7777/Desktop/i686-10.1.0-release-win32-sjlj-rt_v7-rev0.7z mingw32`
`7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on /c/Users/arkay7777/Desktop/x86_64-10.1.0-release-posix-seh-rt_v7-rev0.7z mingw64`
`7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on /c/Users/arkay7777/Desktop/x86_64-10.1.0-release-win32-seh-rt_v7-rev0.7z mingw64`