Game crashes on MacOS when exported

Godot Version

v4.5.1.stable.mono.official [f62fdbde1]

Question

I’ve started to release an update for my game, and it seems to work perfectly fine on all sides. The game’s PCK file is encrypted. The Windows version works perfectly fine, for Linux we released both a normal executable, AND created an AppImage file, both of which work perfectly fine, but as soon as we tried to release for MacOS, it all fell apart.

Exporting the game as a DMG or APP file will both crash on startup with the following exception:

Summary

System Integrity Protection: enabled

Triggered by Thread: 17, Dispatch Queue: com.apple.MTLCompilerConnectionQueue

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xb48dae71ce0bd29e
Exception Codes: 0x0000000000000001, 0xb48dae71ce0bd29e

Termination Reason: Namespace SIGNAL, Code 11, Segmentation fault: 11
Terminating Process: exc handler [7852]

VM Region Info: 0xffffae71ce0bd29e is not in any region.
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
—>
UNUSED SPACE AT END

This seems to be similar to Game crashes on launch in 4.2.1, not 4.2 and that still had no officialy reply or a solution it seems.

Once again, the game works perfectly fine on every other platform, and the MacOS build was even notarized so that shouldn’t be the issue. The game itself runs perfectly fine inside the editor on the same mac system. (It’s a Macbook Air M4 from this year.)

No, I do not use any GDExtension addons.

EDIT: This also seems to happen in a completely empty project!

I’m assuming it’s handing a bad pointer to the shader compiler, based on the SIGSEGV (bad pointer) and the thread being MTLCompilerConnectionQueue, which implies the metal shader compilation process to me.

Presumably that’s a bug in the Godot engine somewhere in the mac support code.

I did some digging. I noticed that this doesn’t happen if I use the official export templates. So I started experimenting, and after an hour or so I discovered what was wrong.

…I kind of forgot to include the module_mono_enabled=yes option :sweat_smile:

3 Likes