Talk:Source code compiling/Makefiles
mingw-w64 Installations
Here's what I've been telling people how to compile 64-bit SRB2.
Download the Package
Refer to this list of mingw-w64 packages from SourceForge, at the bottom of the files page.
https://sourceforge.net/projects/mingw-w64/files/#readme
I use these packages -- GCC 7.3.0. Download both of these packages to build for both 32-bit and 64-bit. You need both packages separately to compile for either bitness.
- 32-bit: i686-win32-dwarf
- 64-bit: x86_64-win32-seh
How to Setup
I like using the 7-zip packages from SourceForge because I don't need to deal with any weird installers.
The compiler and debugger are exactly where I extract them, and I know exactly what is happening to them and what steps I did to set them up.
- Download both 32-bit and 64-bit mingw-w64 packages, if you want to compile for both 32-bit and 64-bit.
- Extract the 7-zip packages to separate folders
- Remove any current MinGW installations from your PATH.
- Optionally, add the new MinGW-W64 installation to the beginning of your PATH -- only one at any time.
- So if you want to compile for 64-bit, add the 64-bit MinGW-W64 installation to your PATH. To compile for 32-bit, add the 32-bit MinGW-W64 installation. Do not have both in the PATH at the same time.
- You may be able to get away with not using the PATH at all, and just calling
mingw32-make.exe
with its direct location. I have not tested this.
How to Compile
If you added the 32-bit or 64-bit install to your PATH:
- 32-bit:
mingw32-make.exe MINGW=1 SDL=1 CC=gcc WINDOWSHELL=1 NOOBJDUMP=1
- 64-bit:
mingw32-make.exe MINGW64=1 SDL=1 CC=gcc WINDOWSHELL=1 NOOBJDUMP=1
If you have not added either install to your PATH, call the make EXE directly (I have not tested this):
- 32-bit:
C:\path\to\i686-mingw-w64\bin\mingw32-make.exe MINGW=1 SDL=1 CC=gcc WINDOWSHELL=1 NOOBJDUMP=1
- 64-bit:
C:\path\to\x86_64-mingw-w64\bin\mingw32-make.exe MINGW64=1 SDL=1 CC=gcc WINDOWSHELL=1 NOOBJDUMP=1
How to Run
When you double-click the srb2win.exe and it gives you a 0xc0000007b
error, that means you do not have the correct DLLs to run the EXE. You need to include these in the same folder as the EXE:
- 32-bit DLLs: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x86-assets.7z
- 64-bit DLLs: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x64-assets.7z
How to Debug
gdb.exe
is located in C:\path\to\mingw-w64\bin\gdb.exe
. Both 32-bit and 64-bit debugging work for me in Visual Studio Code -- variables, breakpoints, etc. I haven't tried it outside of that program.
Alternatively, AppVeyor
Finally, as an alternative to setting up mingw, you can also recommend people to use AppVeyor to build their binaries, both 32 and 64-bit. This is undoubtedly easier than setting up your own toolchain -- but slightly less convenient than building on your own machine.
Provide instructions to push their code to GitHub, then set up their SRB2 fork at appveyor.com, then it will build the EXEs automatically and upload them as job artifacts. Ask Jimita -- I got the idea from him :)