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

macOS build

Open Laim opened this issue 3 years ago • 45 comments

Hey,

I'm using Facepunch.Steamworks for my Steam integration for a game I'm releasing on Windows and macOS. When running the game in the Unity Editor it's connecting with steam fine, unlocking achievements etc.

If I build the game for Windows and upload it to Steamworks and install via Steam it works fine, as well as running it as a standard out of steam game using 480 or my own game Steam ID.

However, when I build the game for macOS, it looks like the .dll isn't being included in the build. I've gone through the .app and the windows build, in the windows build I have the 'Plugins' folder inside Game_Data and can see steam_api64.dll, but nothing in the macOS build.

Anyone else seen this?

Laim avatar Aug 29 '21 14:08 Laim

I've had a look at this, https://github.com/Facepunch/Facepunch.Steamworks/issues/11, but it's from 2017 and that class/method doesn't appear to exist anymore.

Laim avatar Aug 29 '21 14:08 Laim

OK it looks like it might be an issue with building the game for Intel 64-bit AND Apple Silicon (M1 Chips). I've removed Silicon support and it looks to be building it fine, so looks like either a new release is needed for Silicon support or I'll need to update some settings.

Just an FYI for anyone that comes across this!

Laim avatar Aug 29 '21 14:08 Laim

I'm also seeing issues when creating a MacOS build with the Architecture set to Intel 64-bit + Apple silicon. Only building for Intel 64-bit works flawlessly. It'd be great if we could get a fix for the Apple Silicon builds!

gregorgabrovsek avatar Sep 19 '21 12:09 gregorgabrovsek

I would also love to see a fix for this! Steamworks.NET recently addressed this: https://github.com/rlabrecque/Steamworks.NET/pull/414

Pattrigue avatar Oct 02 '21 19:10 Pattrigue

I'm getting this error from SteamClient.Init when running an Intel + silicon build:

System.DllNotFoundException: libsteam_api
  at (wrapper managed-to-native) Steamworks.SteamAPI+Native.SteamAPI_Init()
  at Steamworks.SteamAPI.Init () [0x00001] in <e385b4c78c0940819c8b38e56fb84260>:0 
  at Steamworks.SteamClient.Init (System.UInt32 appid, System.Boolean asyncCallbacks) [0x00039] in <e385b4c78c0940819c8b38e56fb84260>:0 
  at Feed.SteamController.Initialize () [0x00026] in <881b8442410847478494c65c6ebe48dd>:0 

Same issue? I'm yet to test with an intel build.

rhys-vdw avatar Oct 12 '21 05:10 rhys-vdw

I'm getting this error from SteamClient.Init when running an Intel + silicon build:

System.DllNotFoundException: libsteam_api
  at (wrapper managed-to-native) Steamworks.SteamAPI+Native.SteamAPI_Init()
  at Steamworks.SteamAPI.Init () [0x00001] in <e385b4c78c0940819c8b38e56fb84260>:0 
  at Steamworks.SteamClient.Init (System.UInt32 appid, System.Boolean asyncCallbacks) [0x00039] in <e385b4c78c0940819c8b38e56fb84260>:0 
  at Feed.SteamController.Initialize () [0x00026] in <881b8442410847478494c65c6ebe48dd>:0 

Same issue? I'm yet to test with an intel build.

I'll need to reproduce the issue so I can add it to the original issue post; but that does look like the exact same issue!

It was libstream_api that was complaining, that I know, and it was failing on Init - so it would make sense. I'd definitely try running it as just Intel and see how you get on.

Laim avatar Oct 12 '21 10:10 Laim

It was libstream_api that was complaining, that I know, and it was failing on Init - so it would make sense. I'd definitely try running it as just Intel and see how you get on.

Yes, it was. Had a hell of a time working out how to switch the target architecture in build haha. For anyone else looking for the solution it's this:

UnityEditor.OSXStandalone.UserBuildSettings.architecture = UnityEditor.OSXStandalone.MacOSArchitecture.x64;

source

The build settings are stored in user preferences, not the project settings, so you need to set it before you run the build command. (This is if you're using a build script, you can of course select it in the build dialogue if that's your jam.)

rhys-vdw avatar Oct 13 '21 02:10 rhys-vdw

I'm having a similar issue. Here's my player.log - like others, it works fine in the editor, but not in the player:

` Initialising Steam... Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.dylib Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.dylib Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.so Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.bundle Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.dylib Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.dylib Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.so Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api.bundle Fallback handler could not load library /Users/tom/Library/Application Support/Steam/steamapps/common/Black Forest/Black Forest.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsteam_api error initialising Steam: System.DllNotFoundException: libsteam_api assembly: type: member:(null) at (wrapper managed-to-native) Steamworks.SteamAPI+Native.SteamAPI_Init() at Steamworks.SteamAPI.Init () [0x00001] in :0 at Steamworks.SteamClient.Init (System.UInt32 appid, System.Boolean asyncCallbacks) [0x00039] in :0 at BlackForest.SteamManager.Start () [0x0000a] in <1655321de84845b881c3a96792ff9dbb>:0

`

tvogt avatar Oct 22 '21 19:10 tvogt

Also noting that builing just for macOS Intel doesn't fix the issue in my case. Still getting the same error.

tvogt avatar Oct 23 '21 22:10 tvogt

Is this issue related to https://github.com/rlabrecque/Steamworks.NET/issues/393 ?

Seems like a bigger blocker right now for MacOS builds, as they default to Intel+Silicon archs. I'm also not sure if removing Silicon arch will then cause problems for M1 Macs?

Is it maybe as simple as setting image from: image to: image ?

( Saw it mentioned in this comment https://github.com/rlabrecque/Steamworks.NET/issues/393#issuecomment-763878947 )

Editing file Assets/Plugins/Facepunch.Steamworks/re…/libsteam_api.bundle.meta with:

  - first:
      Standalone: OSXUniversal
    second:
      enabled: 1
-     settings: {}
+     settings:
+       CPU: AnyCPU

mastef avatar Dec 13 '21 11:12 mastef

Not sure if your screenshots are around the wrong way, but you want CPU to be Intel 64-bit only. If you try and build it for M1/Sillicone support included, it fails to include the libraries.

And as far as I'm aware, yes it stops it from working on M1 macs until the library is updated (sadly). I was going to migrate to something else but it's too integrated into my game now for it to be worth the hassle unfortunately.

Laim avatar Dec 13 '21 12:12 Laim

Not sure if your screenshots are around the wrong way, but you want CPU to be Intel 64-bit only. If you try and build it for M1/Sillicone support included, it fails to include the libraries.

The first screenshot is how it is right now. The bundle is only included in intel 64 builds. Hence if you try to build for intel 64 + m1 it won't include the library, since it's restricted to intel 64-only builds.

Then I changed the bundle to be for "any" macos build ( meaning intel 64 + m1 ).

Built the game for intel 64 + m1 and I don't have a libsteam_api error currently. The game is correctly connecting to Steam on an intel 64 mac.

I have not tested the game on a m1 mac, yet. But it's already a step further than it was before.

mastef avatar Dec 13 '21 14:12 mastef

Just tested on a Mac Mini. M1 will still fail with libsteam_api not found, but intel builds have Steam included. So it's a half-working solution until the libsteam_api.bundle is updated. Intel macs will be able to connect to Steam.

mastef avatar Dec 13 '21 14:12 mastef

How does libsteam_api.bundle get updated? I really don't want to give up native builds! Steamworks.NET seems to work fine on Apple Silicon but it also sucks.

wilg avatar Jan 07 '22 20:01 wilg

@garrynewman I know it's annoying to get pinged - sorry. It would be really cool if the bundle files could be updated with a new release due to this new technology that was introduced since the last release

mastef avatar Jan 12 '22 08:01 mastef

Any updates on if m1 support will be added at some point? Trying to decide if I should make my game with facepunch.steamworks or with steamworks.net which seems to work with m1.

freeeranger avatar Apr 21 '22 09:04 freeeranger

I gave up and used steamworks.NET

wilg avatar Apr 21 '22 18:04 wilg

which sucks

wilg avatar Apr 21 '22 18:04 wilg

I have no plans to try to support M1, sorry

garrynewman avatar Apr 21 '22 18:04 garrynewman

I have no plans to try to support M1, sorry

@garrynewman I think it's just updating the Steamworks dll / libsteam_api.bundle to latest version, no? Should have m1 in it. I'm not sure how you generate it/where you get it from

mastef avatar Apr 21 '22 19:04 mastef

@garrynewman I see, really unfortunate. You should however at least update the readme to clearly state that m1 mac isn't supported, since just saying that macOS is supported is kind of false marketing and can lead to a lot of people (including me) starting to develop their games with this library without realizing that it doesn't fulfill their needs platform-wise.

freeeranger avatar Apr 21 '22 20:04 freeeranger

I have no plans to try to support M1, sorry

any chance of making such plans? Because otherwise I'll have to rip out facepunch and replace it with steamworks or something else and that would really suck because facepunch is by far the best steam lib.

tvogt avatar Apr 27 '22 13:04 tvogt

I think it's just updating the Steamworks dll / libsteam_api.bundle to latest version, no? Should have m1 in it. I'm not sure how you generate it/where you get it from

Does anyone know how libsteam-api.bundle comes into being? If it is just a case of repackaging the Steam dll with a newer version, can we fork the repo with that?

mattluard avatar Aug 21 '22 19:08 mattluard

Has anyone been able to figure out how to update libsteam-api.bundle to fix the m1 fiasco ? @garrynewman we understand you might not be interested in updating the project or have time to maintain it, but perhaps please point us in the right direction so some of us can try our hands at it.

If I am not wrong, I think we need to rebuild the DLLs using master branch but with steamworks_sdk 1.52 which added support for m1, is that it ?

shubhank008 avatar Sep 24 '22 19:09 shubhank008

Sorry for the necro but for anyone reading Steamworks SDK 1.52 does indeed work. I built a version using the latest at time of writing 1.55 and just successfully deployed a Silicon build. I removed the 32 bit dlls entirely.

NFMynster avatar Mar 08 '23 20:03 NFMynster

any chance of an updated release with a recent steam library and recent macos support?

delzrm avatar Mar 10 '23 09:03 delzrm

It took me way longer than I wanted to spend on recompiling this. Compiling on my Mac didn't seem possible, had to boot into Windows, install all sort of outdated .net SDK's.

To save anyone the trouble, here's the build. Works on my M2, also in the silicon editor. Last commit in this build: 4e7e0ef8c406bdf75f52d9fb1537713f75ce865b SDK version steamworks_sdk_155

Facepunch.Steamworks.zip

Update March 24th: I've updated the zip file. It had the steam_api.dll and steam_api64.dll twice, once in the root folder and once in the redistributable_bin folder. This wasn't an issue in play mode, but once I've tried to build for Windows, it failed. Removed files from the root folder (checked old build, didn't have them in root either) and was able to build for Windows.

barrykooij avatar Mar 21 '23 23:03 barrykooij

Thanks Barry!

I've grabbed a copy, in case it's useful one day for me!

I've not started using Steamworks at all yet, but I'm subscribed to the Facepunch Dev just to get my head around things.

The idea of having a precompiled "recent-ish" version seems very helpful! As I'm sure I'll be pulling my hair out when I go to try to get up to speed on actually using it.

All the best!

Murray Lorden MUZBOZ Games https://www.muzboz.com/

On Wed, 22 Mar 2023 at 10:49, Barry Kooij @.***> wrote:

It took me way longer than I wanted to spend on recompiling this. Compiling on my Mac didn't seem possible, had to boot into Windows, install all sort of outdated .net SDK's.

To save anyone the trouble, here's the build. Works on my M2, also in the silicon editor. Last commit in this build: 4e7e0ef https://github.com/Facepunch/Facepunch.Steamworks/commit/4e7e0ef8c406bdf75f52d9fb1537713f75ce865b SDK version steamworks_sdk_155

Facepunch.Steamworks.zip https://github.com/Facepunch/Facepunch.Steamworks/files/11034905/Facepunch.Steamworks.zip

— Reply to this email directly, view it on GitHub https://github.com/Facepunch/Facepunch.Steamworks/issues/591#issuecomment-1478735946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOZYIPDGHNYCZZUEA37YZDW5I5BXANCNFSM5DAJRSGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

muzboz avatar Mar 22 '23 01:03 muzboz

It took me way longer than I wanted to spend on recompiling this. Compiling on my Mac didn't seem possible, had to boot into Windows, install all sort of outdated .net SDK's.

To save anyone the trouble, here's the build. Works on my M2, also in the silicon editor. Last commit in this build: 4e7e0ef SDK version steamworks_sdk_155

Facepunch.Steamworks.zip

This honestly needs more love.

Chizaruu avatar Mar 23 '23 14:03 Chizaruu

We also managed to get this compiling! It refused to compile with visual studio 2019 for me, no matter how many .net sdk versions I installed... I got it building with visual studio 2022 in the end.

delzrm avatar Mar 23 '23 14:03 delzrm