Skip to content

Instantly share code, notes, and snippets.

@syskrank
Created February 12, 2019 15:05
Show Gist options
  • Save syskrank/32ff7d3dd31a8bcc9c52bf8d8f42e720 to your computer and use it in GitHub Desktop.
Save syskrank/32ff7d3dd31a8bcc9c52bf8d8f42e720 to your computer and use it in GitHub Desktop.
Build Godot 3.1 on Windows using MinGW

Building Godot Engine 3.1 from source on Windows using MinGW

Godot engine could be successfully compiled on Windows machine using MinGW toolchain only ( no VS dependencies ). This HOWTO was tested on Windows 10 x64 host.

Here's how you do it.

0. Clone Godot engine or download & unpack the source code.

2. Install some appropriate version of the compiler suite ( I was using 7.3.0 ).

NOTE: Do not use GCC < 5.0 due to high possibilities of linker errors. Also, make sure to select seh or sjlj exception models and posix threads. I was using seh

I was using Python 3.7.2 x64.

4. Add Python to your PATH variable (e.g. C:\Python37 )

You will need SCons build tool as long as the python extensions pywin32. They could be obtained via pip.

5. Install dependencies using pip

Run in cmd: pip install pywin32 Also run in cmd: pip install scons

6. Open up cmd and navigate to the root of your cloned Godot engine repository or to the unpacked source archive.

7. IMPORTANT: Set environment variables:

PATH=C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;C:\Python37\Scripts;%PATH%

Make sure to substitute my paths and versions with yours. You can change threads number according to your CPU ( -jN, where N is number of cores)

Also, make sure to read the docs for more build targets and options:

Godot build system Compiling for X11 (useful for targets)

8. Build Godot engine with:

scons -j4 platform=windows target=release_debug use_mingw=true

The resulting .exe file will be located inside the bin folder within the source code tree.

9. Cleaning up

To clean the build tree, invoke: scons -c platform=windows target=release_debug use_mingw=true

Make sure to put in correct target name.

Links

This manual was extremely useful IRC logs about linker errors with SizeTToULong

Troubleshooting

Compilation errors

Check that Godot source is not modified or that you know what you're doing. Fix the code errors, if there are any. Ensure the right toolchain version.

Linker errors

They may vary. Common steps are to clean up the build tree, ensure the valid toolchain & environment vars and repeat the steps. Make sure to google error messages.

Linker hangs

Make sure to export PATH variable manually before invoking scons. Also, use more recent MinGW version ( GCC > 5 ). I was experiencing longer link times and also a hanging linker while I was trying to build the debug target.

There was also a known bug with MinGW linker but it might be non-relevant.

Last time I tried to build the 'debug' target, the build system seems to fall asleep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment