Steamworks.NET
Steamworks.NET copied to clipboard
Mac Apple Silicon: Could not load [lib]steam_api.dll/so/dylib.
I've updated my Unity game project to 2020.3 in order to make Apple Silicon builds on my Mac (M1 Pro). We updated to the latest version of Steamworks.NET to get the fixes done earlier this year for Apple SIlicon. Runs fine in the editor, but the build is still crashing during the initial launch:
Many of this error: Fallback handler could not load library /Users/davidtschaller/GameBuilds/Dual build/WolfQuestAE.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.bundle Fallback handler could not load library /Users/davidtschaller/GameBuilds/Dual build/WolfQuestAE.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api
Followed by: [Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details. System.DllNotFoundException: steam_api at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(Steamworks.AppId_t) at Steamworks.SteamAPI.RestartAppIfNecessary (Steamworks.AppId_t unOwnAppID) [0x00005] in <659ebd1b102c40e8a791bf012aafde84>:0 at SteamManager.Awake () [0x00061] in <659ebd1b102c40e8a791bf012aafde84>:0
I opened the game package and there isn't a MonoEmbedRuntime folder inside Frameworks. I can't find libsteam at all. Not sure what to do or what could have gone wrong -- appreciate any suggestions!
thanks Dave
Hey there, could you try fiddling with the platform settings on steam_api.bundle
inside the Unity editor it could be that they are not set correctly for the new M1 compatible bundle.
I do not have access to a modern Mac to test this out on unfortunately.
I've tried setting those to Any CPU and Any OS on libsteam_api and steam_api64, but the build still crashes. I reread that thread about this but don't see anything else to try. (Well, the Intel build works but the whole point of upgrading to 2020.3 is to get Apple Silicon native builds.) Do you know of a discussion thread about this that's currently active where I could ask for help?
Though I'm unclear about the fix in 414 -- should the steam_api64 work on Apple Silicon? If it's a 64-bit thing, I wouldn't expect it to...so what was done in 414 that should make this work in native Apple Silicon builds?
EDIT: That is, even if I can figure out how to get these files in the place that the game is expecting them, would steam_api64 work, or would it still choke since it's not native?
Just to clarify by latest, do you mean the Steamworks.NET 20.0.0 release (or from the master branch within the last week)?
Anything pre-Steamworks 1.52 definitely won't work.
It looks like if you are using the Unity Package Manager version you can't actually change this, so you'll need to import it from git, or with the 20.0.0 .unitypackage
I also wonder if there's something up with the Info.plist
file inside the steam_api.bundle 🤔
Oh, we are indeed using the github link in package manager, and now I see that means we have 15.0.1. So we will try this again with the 20.0.0 unitypackage. Thanks!
For sure, let me know if that ends up working, hopefully as simple as changing it from Any CPU to Apple silicon 🙏
I wonder what the implications of setting that as the default is for Unity pre-2020.3 ?
I hoped that Any CPU would work fine in both cases but, maybe that points to a deeper issue with the Info.plist
Same problem. Player on Steam said that the crashes stopped after i use 20.0.0 version.
Unfortunately, I also do not have a Mac to check this.
I have an M1 mac if you want me to help you troubleshoot.
Seeing this in 20.1.0. After changing CPU setting described above does not seem to have any affect.
When I export an archive of the app I can see steam_api.bundle
under PlugIns with related files.
Error message...
[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.
System.DllNotFoundException: Unable to load DLL 'steam_api': The specified module could not be found.
Hey, yeah some help on this would be absolutely fantastic.
If you're up to messing with things on your own, the place that I'd start is:
- Ensure you're using a non-Unity Package build, so that changing this stuff is easier.
- You tried this already but playing with the CPU setting on the .bundle both for in-editor and package builds is likely necessary.
- We may have to make changes to this file: https://github.com/rlabrecque/Steamworks.NET/blob/master/com.rlabrecque.steamworks.net/Plugins/steam_api.bundle/Contents/Info.plist It's basically untouched from 3+ years ago, well-predating M1. I currently have no idea what these changes might be, IIRC it's possible to load this file in XCode and have dropdowns for the selection options?
Update:
- Using manually imported
Steamworks.NET_20.1.0.unitypackage
- Set properties for
steam_api.bundle
Editor and Standalone to "Apple silicon" - Adjusted info.plist for bundle so that it matches format of official unity purchasing bundle
- Set overall build target to
Apple silicon
orIntel 64-bit + Apple silicon
No luck, However...
- Put all settings back to normal
- Set overall build target to
Intel 64-bit
Works!
Inspection of the binary leads me to believe steam_api.bundle does not include arm64 (silicon) architecture so it will not work unless you build the whole project for Intel ONLY, forcing the project to run under Rosetta (64-bit).
You can check an exported app with the following command:
file [YOUR_EXPORTED_APP]/PlugIns/steam_api.bundle/Contents/MacOS/libsteam_api.dylib
it outputs:
PlugIns/steam_api.bundle/Contents/MacOS/libsteam_api.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64]
Depict/PlugIns/steam_api.bundle/Contents/MacOS/libsteam_api.dylib (for architecture i386): Mach-O dynamically linked shared library i386
Depict/PlugIns/steam_api.bundle/Contents/MacOS/libsteam_api.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
vs another bundle, like unitypurchasing
unitypurchasing: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64]
unitypurchasing (for architecture x86_64): Mach-O 64-bit bundle x86_64
unitypurchasing (for architecture arm64): Mach-O 64-bit bundle arm64
After comparing the binaries included in 20.1.0.unitypackage, master branch, and my local copy I have no idea how the version in my local copy came to be missing the arm64 architecture. I replaced the dylib with the one from master branch and it's working perfectly.
If anyone else has this issue, make sure you have latest libsteam_api.dylib in your project.
Have the same issue(crash on start using Intel 64 mac):
[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details. System.DllNotFoundException: steam_api
20.1.0.unitypackage, Unity.3.26f1, building target Intel 64 + Apple silicon. Relplacing libsteam_api.dylib from master branch doesn't help.
I am able to make build using Intel 64 and it works on Intel 64 mac.
Is there any change to fix it?
Any news on the issue, as it still persists nowadays on the Mac editor with Silicon?
Could not find executable at '/Users/dev-vm/Desktop/unity_project/Wtj/Temp/StagingArea/WTJ.app/Contents/PlugIns/steam_api.bundle/Contents/MacOS/steam_api' inside a bundle.
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
when build finish it outputs such log, does it have something to do with filename?
later i find
Info.plist
is missing in my project, after reimport/replacing the steam_api.bundle
it now works without problem...
maybe some weird setup could lead setup corruption.