britzl / steamworks-defold

Steamworks support for Defold using the Defold extension system
34 stars 6 forks source link

Crash when trying to use any version of steamworks (Library not loaded: @loader_path/libsdkencryptedappticket.dylib) #22

Open GriffinSego opened 2 years ago

GriffinSego commented 2 years ago

When trying to build this repro on my main computer (mac M1) the build fails and gives me the following error:

dyld[68470]: Library not loaded: @loader_path/libsdkencryptedappticket.dylib
  Referenced from: /Users/grify/Documents/Dev/GitHub/steamworks-debug/build/x86_64-osx/dmengine
  Reason: tried: '/Users/grify/Documents/Dev/GitHub/steamworks-debug/build/x86_64-osx/libsdkencryptedappticket.dylib' (no such file), '/usr/local/lib/libsdkencryptedappticket.dylib' (no such file), '/usr/lib/libsdkencryptedappticket.dylib' (no such file)

Am I making a mistake or is this an actual bug? I've tested on steamworks versions 1.4.1–latest and all of them crash with this same error regardless of context but removing steamworks from dependencies and fetching libraries again to clear it out allows the build to pass.

the repro: https://static-cdn.grify.dev/steamworks-debug.zip

britzl commented 2 years ago

This is when you build and run from the editor? The problem is that the dynamic libraries from the extension aren't copied when you build and run. The project should run properly if you bundle it.

@subsoap how do you deal with the Steam integration in your games to avoid this problem?

subsoap commented 2 years ago

I believe we put the libs in the root folder of the project and that makes it work.

GriffinSego commented 2 years ago

This is when you build and run from the editor? The problem is that the dynamic libraries from the extension aren't copied when you build and run. The project should run properly if you bundle it.

Yes, that's correct. How do I allow the editor to properly build the extension? Is this an engine flaw or an extension oversight? What should I do in order to be able to build and run with this extension in the editor? It would be rather burdensome indeed to need to bundle the project every time I wished to run my code simply to enable steam capability.

I believe we put the libs in the root folder of the project and that makes it work.

Do you mean copying https://github.com/britzl/steamworks-defold/tree/master/steamworks/lib to the project dir?

subsoap commented 2 years ago

The ones specific to the active OS / macOS yes

https://github.com/britzl/steamworks-defold/tree/master/steamworks/lib/osx

GriffinSego commented 2 years ago

The ones specific to the active OS / macOS yes

https://github.com/britzl/steamworks-defold/tree/master/steamworks/lib/osx

I added the files as recommended but when I placed the raw dylib files into the build folder, they are deleted when the build folder is autoregenerated upon building. The error message specifically said that it needed the lib files to be located at /Users/grify/Documents/Dev/GitHub/{project}/build/x86_64-osx/libsdkencryptedappticket.dylib but since I am unable to add those corresponding files directly, where should I add them? How can I make the build folder generate them too or at least leave them in? I have tried putting the dylib files in project root, /libs/, /lib/ etc but nothing works. My project dir is now littered with many copies of the lib files under every subdir to no avail. I wish this were more intuitive to me.

I apologize for my frusterating lack of intelligence but I must request a tad more handholding through this process in order to make it work. Where exactly can I put these two osx .dylib files in order to make them work correctly and get generated into the build folder?