Skip to content

Segmentation fault when loading luasteam on x86 macOS, but not arm64 #44

@RuairiD

Description

@RuairiD

I've been able to use luasteam in a game without issue in Windows, Linux and arm64 macOS, but I'm having trouble with x86 macOS. I'm using Steamworks SDK version 1.53a as this was the first version where libsteam_api.dylib supported arm64, and I never bothered updating further during development, and luasteam version 1.2.0 as this was the latest version at the time when I added Steam integration to the game in question.

I've put together a minimal example with .so and .dylib files for x86 and arm64 macOS: luasteam-x86-crash-minimal-example.zip. osx_x86_luasteam.so is taken directly from the 1.2.0 release and osx_arm64_luasteam.so was re-compiled for arm64.
The example copies the .so and .dylib files to the LÖVE save directory and loads them from there (I can't remember completely since this was more than a year ago, but loading .so files didn't seem to work of they were inside a .love file?). Running the example on both architectures (actual machines, no Rosetta involved) yields the following outputs:

arm64

$ love luasteam-x86-crash-minimal-example
love.system.getOS	OS X
jit.arch	arm64
Copying luasteam lib files to /Users/ruairi/Library/Application Support/LOVE/luasteam-x86-crash-minimal-example/copied-lib/
Copying file .DS_Store to copied-lib/.DS_Store...
Copying file libsteam_api.dylib to copied-lib/libsteam_api.dylib...
Copying file osx_arm64_luasteam.so to copied-lib/osx_arm64_luasteam.so...
Copying file osx_x86_luasteam.so to copied-lib/osx_x86_luasteam.so...
Loading luasteam lib from /Users/ruairi/Library/Application Support/LOVE/luasteam-x86-crash-minimal-example/copied-lib/osx_arm64_luasteam.so
Loaded luasteam lib successfully.
Attempting Steam.init()...
[S_API] SteamAPI_Init(): Loaded '/Users/ruairi/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamclient.dylib' OK.
Setting breakpad minidump AppID = 2393770
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561198051111097 [API loaded no]
Steam.init() succeeded.
Steam.userStats.onUserStatsReceived() called.

x86

$ love luasteam-x86-crash-minimal-example
love.system.getOS	OS X
jit.arch	x64
Copying luasteam lib files to /Users/ruairi/Library/Application Support/LOVE/luasteam-x86-crash-minimal-example/copied-lib/
Copying file .DS_Store to copied-lib/.DS_Store...
Copying file libsteam_api.dylib to copied-lib/libsteam_api.dylib...
Copying file osx_arm64_luasteam.so to copied-lib/osx_arm64_luasteam.so...
Copying file osx_x86_luasteam.so to copied-lib/osx_x86_luasteam.so...
Loading luasteam lib from /Users/ruairi/Library/Application Support/LOVE/luasteam-x86-crash-minimal-example/copied-lib/osx_x86_luasteam.so
[1]    35802 segmentation fault  love.app/Contents/MacOS/love luasteam-x86-crash-minimal-example

If I remove the .dylib file, the example fails gracefully without crashing as the .so file can't find the .dylib file. Not sure if this is a useful clue since much of this is beyond my experience but chucking it in there just in case.

Thanks in advance, really appreciative of any suggestions or pointers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions