Build failed for MacOS version of Unity Project with GOG SDK

  1. We tried to build MacOS version of our Unity Game with GOG SDK Version : 1.144.1
    and the build failed with error in Unity 2021.3.2f1, 2021.3.8f1, and 2022.20b6 on MacOS Monterey 12.3.1 :

Building /Users//.app/Contents/PlugIns/Galaxy.bundle/Contents/MacOS/libGalaxyCSharpGlue.dylib failed with output:
Failed because this command failed to write the following output files: /Users//.app/Contents/PlugIns/Galaxy.bundle/Contents/_CodeSignature/CodeResources

This is from the Editor log :

System.Exception: Could not find executable at ‘/Users//.app/Contents/PlugIns/Galaxy.bundle/Contents/MacOS/Galaxy’ inside a bundle.

From a Editor log message above, it shows that Unity could not find executable at .app/Contents/PlugIns/Galaxy.bundle/Contents/MacOS/Galaxy

  1. From previous errors, we got a workaround to build the game by renaming ‘libGalaxy.dylib’ and ‘libGalaxyCSharpGlue.dylib’ to ‘Galaxy’ and ‘GalaxyCSharpGlue’ with no extensions and can build successfully but then when we run the game, it produces this error log :

DllNotFoundException: Unable to load DLL ‘GalaxyCSharpGlue’. Tried the load the following dynamic libraries: Unable to load dynamic library ‘GalaxyCSharpGlue’ because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen(GalaxyCSharpGlue, 0x0005): tried: ‘GalaxyCSharpGlue’ (no such file), ‘/usr/local/lib/GalaxyCSharpGlue’ (no such file), ‘/usr/lib/GalaxyCSharpGlue’ (no such file), ‘/Users//GalaxyCSharpGlue’ (no such file)

  1. It appears that ‘GalaxyCSharpGlue’ needs to be in the directory that contains our game’s .app file. So, we tried moving GalaxyCSharpGlue to that directory then we encountered a different error:

DllNotFoundException: Unable to load DLL ‘GalaxyCSharpGlue’. Tried the load the following dynamic libraries: Unable to load dynamic library ‘GalaxyCSharpGlue’ because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen(GalaxyCSharpGlue, 0x0005): tried: ‘GalaxyCSharpGlue’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’)), ‘/usr/local/lib/GalaxyCSharpGlue’ (no such file), ‘/usr/lib/GalaxyCSharpGlue’ (no such file), ‘/Users//GalaxyCSharpGlue’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’))

  1. We tried renaming ‘GalaxyCSharpGlue’ back to ‘GalaxyCSharpGlue.bundle’ , ‘GalaxyCSharpGlue,dylib’, and ‘ ‘libGalaxyCSharpGlue.dylib’ but nothing work.

I’m struggling with the same thing, did you ever found a solution?

Found the solution:
For some reason, Unity won’t include the files in the build. But all you need to do is to copy the two dylib files mentioned above into the /Content/Plugins folder after the build is finished

Hey,

Cyprian from GOG Dev Support here!
If you experience any issues with implementing GOG SDK in your game, please don’t hesitate to contact us :slight_smile:

You can contact Dev Support via devportal, simply open devportal, select: Support - > Contact Support(email) or Submit a ticket.

We would appreciate if you could cram as much info as possible in your request(including screenshots and such) :slight_smile:

Hi, GOG Dev Support
As you can tell, the binaries from your SDK are copied correctly during build for Windows and Linux, but not for Mac. This is happening since (at least) Unity 2021 LTS.

I can concur this - unity build does not copy correct binaries on MacOS build

1 Like

I managed to convince it by changing the CPU settings from “Intel” to “AnyCPU”… I’m on an Intel Mac so it does not make a lot of sense, but those platform filters have always been a bit wonky.