Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

Steam lib failure to load causes crash on Mac M1

Open acorsicanfrog opened this issue 4 years ago • 21 comments

Hello guys, first timer here My game has been for a year on Steam and running fine everywhere, but lately M1 Macs cannot run it anymore. If I run the game WITHOUT launching it through Steam, it works. If I use Steam to launch the game, I get a crash and this is the text with the crash. The lines you will be interested in probably are the following : Dyld Error Message: could not load inserted library '/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib' because no suitable image found. Did find: /Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib: no matching architecture in universal wrapper /Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib: stat() failed with errno=1

And here's the full crash report :

`Process: Hex of Steel [2629] Path: /Users/USER/Library/Application Support/Steam/*/Hex of Steel.app/Contents/MacOS/Hex of Steel Identifier: Valentinstudio Version: 5.5.0 (1) Code Type: ARM-64 (Native) Parent Process: ??? [1] Responsible: Hex of Steel [2629] User ID: 501

Date/Time: 2021-06-21 15:03:23.526 +0200 OS Version: macOS 11.4 (20F71) Report Version: 12 Anonymous UUID: F3B625C2-23ED-8353-D18F-EF715FDF0E59

Time Awake Since Boot: 19000 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: DYLD, [0x9]

Application Specific Information: dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH= DYLD_INSERT_LIBRARIES=/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib:/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/gameoverlayrenderer.dylib:/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/gameoverlayrenderer32.dylib DYLD_FALLBACK_LIBRARY_PATH=/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS:/Users/juleslievre/Library/Application Support/Steam/steamapps/common/Hex of Steel:/Users/juleslievre/Library/Application Support/Steam/steamapps/common/Hex of Steel/bin:/usr/local/lib:/lib:/usr/lib

Dyld Error Message: could not load inserted library '/Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib' because no suitable image found. Did find: /Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib: no matching architecture in universal wrapper /Users/juleslievre/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamloader.dylib: stat() failed with errno=1

Binary Images: 0x1024c0000 - 0x1024c3fff +Valentinstudio (5.5.0 - 1) <DEF4DD2F-8142-39D2-8BD8-BEB64BACC720> /Users/USER/Library/Application Support/Steam/*/Hex of Steel.app/Contents/MacOS/Hex of Steel 0x1024f8000 - 0x102577fff dyld (852) <CF624584-51D6-329D-91C5-6BEDFADFB2D2> /usr/lib/dyld

Model: Macmini9,1, BootROM 6723.120.36, proc 8:4:4 processors, 16 GB, SMC Graphics: kHW_AppleM1Item, Apple M1, spdisplays_builtin Memory Module: LPDDR4 AirPort: spairport_wireless_card_type_airport_extreme, wl0: Apr 28 2021 19:53:33 version 18.50.40.7.7.8.119 FWID 01-e6894c69 Bluetooth: Version 8.0.5d7, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en1 USB Device: USB 3.1 Bus USB Device: USB 3.1 Bus USB Device: USB 3.0 Bus USB Device: CORSAIR HARPOON RGB WIRELESS Gaming Mouse Thunderbolt Bus: Mac mini, Apple Inc. Thunderbolt Bus: Mac mini, Apple Inc.`

From my understanding, the game crashes because of the library, how can I do so that the doesn't happen ? I tried building with Unity for Apple Silicon only, to no avail, still crashes.

Is there a special setting I should be choosing or something ? From the inspector on Unity I have this : Capture d’écran 2021-06-21 à 15 16 01 Capture d’écran 2021-06-21 à 15 16 07 Capture d’écran 2021-06-21 à 15 15 55

I will appreciate any help !

acorsicanfrog avatar Jun 21 '21 13:06 acorsicanfrog

It looks like what is happening is that when launching your game from Steam, Steam attempts to inject some binaries to handle functionality such as the Steam overlay. Unfortunately, Steam is attempting to inject x86/x86_64 binaries into an arm64e process, hence the error message "no matching architecture in universal wrapper".

As far as I understand, Steam/Steamworks does not support arm64e (Apple Silicon) at all.

yaakov-h avatar Jun 22 '21 11:06 yaakov-h

So, I fixed it. I mean, what I basically did was to build for intel 64 for MacOS instead of Intel64 + Apple Silicon And that worked Game now launches and plays fine on M1 through and without steam Anyone having the same issue, just build for Intel and not the silicon + intel mix

acorsicanfrog avatar Jun 22 '21 12:06 acorsicanfrog

I'm going to reopen this for now to help people find it better, I think there's something that we can do to improve this too; even just a warning when building for M1.

rlabrecque avatar Jun 22 '21 20:06 rlabrecque

No problems ! I'd be more than happy if this would help other people as well, took me a month to get it working back !!

acorsicanfrog avatar Jun 22 '21 20:06 acorsicanfrog

So can't we ever run the Unity app on M1 with Steam? thought it works fine on M1 without Steam

karennk avatar Jun 30 '21 11:06 karennk

Thanks @valentin56610 You saved my time! I just compile a build with Intel + Apple Silicon. Now, gonna have to build again with Intel only

karennk avatar Jun 30 '21 11:06 karennk

So can't we ever run the Unity app on M1 with Steam? thought it works fine on M1 without Steam

I don't know if this question is for me, but my game runs fine on M1 Macs with Steam. As I said, just export the game for Intel 64 bits. Will work just fine on M1. Don't export for Apple Silicon + Intel, this will result in crashes on M1.

acorsicanfrog avatar Jun 30 '21 11:06 acorsicanfrog

So can't we ever run the Unity app on M1 with Steam? thought it works fine on M1 without Steam

I don't know if this question is for me, but my game runs fine on M1 Macs with Steam. As I said, just export the game for Intel 64 bits. Will work just fine on M1. Don't export for Apple Silicon + Intel, this will result in crashes on M1.

Great and thanks.

Can you please confirm the following, do I need to change them for Mac Steam build?

  1. Steam_api.bundle contains an invalid CFBundleIdentifier: com.rileylabrecque.steam_api. Change it to com.rileylabrecque.steamapi in the file steam_api.bundle/Contents/Info.plist

  2. libsteam_api.dylib contains 32bit symbols. We only use 64bit symbols, delete it with command lipo -remove x86_64 libsteam_api.dylib -o libsteam_api.dylib.

karennk avatar Jun 30 '21 11:06 karennk

I don't know about those 2, unfortunately. I didn't get those.

Everything I did was to build for Intel 64 bits instead of the Apple silicon + intel mix. I suggest you just build and try ? Thats what I usually do

acorsicanfrog avatar Jun 30 '21 11:06 acorsicanfrog

I don't know about those 2, unfortunately. I didn't get those.

Everything I did was to build for Intel 64 bits instead of the Apple silicon + intel mix. I suggest you just build and try ? Thats what I usually do

Alright. Thanks

karennk avatar Jun 30 '21 11:06 karennk

@rlabrecque @valentin56610 I'm not really sure what files need to be included/excluded in Mac depot. Please let me know if you can help! Thank you!

// but exclude all symbol files // This can be a full path, or a path relative to ContentRoot

"FileExclusion" "*.pdb"

karennk avatar Jul 01 '21 10:07 karennk

Hum, not sure this is related to the original issue at all ?

Build the game with unity, then once built unity take you to the place the game was built, select then all files and hit "Compress/ZIP". That's all I do. You upload that .ZIP to steam.

acorsicanfrog avatar Jul 01 '21 12:07 acorsicanfrog

Hum, not sure this is related to the original issue at all ?

Build the game with unity, then once built unity take you to the place the game was built, select then all files and hit "Compress/ZIP". That's all I do. You upload that .ZIP to steam.

Alright. Thanks. Uploaded .zip

karennk avatar Jul 01 '21 14:07 karennk

I've uploaded notarized and stapled Zip

karennk avatar Jul 01 '21 15:07 karennk

Supposedly Valve finally provides version of steamwork dylibs which include arm64 build as well https://store.steampowered.com/news/group/4145017/view/2984186817523157398 . Has anyone tried it already?

karliss avatar Oct 26 '21 07:10 karliss

Supposedly Valve finally provides version of steamwork dylibs which include arm64 build as well https://store.steampowered.com/news/group/4145017/view/2984186817523157398 . Has anyone tried it already?

Well, the site where I get the lib for Unity didn't update yet, last update was May 2021. I wonder when they are going to update for the new lib Link of the site in question : https://steamworks.github.io

What do you guys use ?

acorsicanfrog avatar Oct 26 '21 08:10 acorsicanfrog

Supposedly Valve finally provides version of steamwork dylibs which include arm64 build as well https://store.steampowered.com/news/group/4145017/view/2984186817523157398 . Has anyone tried it already?

This is fantastic news - I just saw PR https://github.com/rlabrecque/Steamworks.NET/pull/452 adds v1.52!

jonjondev avatar Oct 31 '21 13:10 jonjondev

After testing, I can confirm this has solved all our issues for Steamworks on Apple Silicon!

jonjondev avatar Nov 01 '21 09:11 jonjondev

The thread says it’s in beta, is it working alright ? I’ll probably wait until it’s fully released in the main repository

acorsicanfrog avatar Nov 01 '21 09:11 acorsicanfrog

It works just fine. Though we don't use a huge amount from the API (just some achievements stuff) so we're not the best example, but v1.52 is what I'm downloading direct from Valve in the Steamworks portal and it's already on main for this repo. Very easy to get it through the UPM if you're using Unity by just changing the commit hash you're pointing to.

jonjondev avatar Nov 01 '21 10:11 jonjondev

Hi, have there been any updates to this? Are there any more blockers to adding arm64 OSX-Linux support?

mcpower avatar Mar 17 '24 11:03 mcpower