Search code examples
c#shared-librariessteamworks-api

Unable to load shared library 'libsteam_api' with Facepunch Steamworks on linux


I am trying to deploy a small Steamworks program to my server, however, when I try to build it for Linux I encounter Unable to load shared library 'libsteam_api'. I have included the libsteam_api.so file in the output directory bin/Debug/net5.0 and linked it in my csproj

<Content Include=".\lib\libsteam_api.so">
   <Link>libsteam_api.so</Link>
   <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

Additionally while researching this issue I learned that a fix could be to put the libsteam_api file in /usr/lib however, this did not solve the issue for me. I am using C# net5.0, and the Posix version of Facepunch.Steamworks on Ubuntu.

The error message includes that I could try setting LD_DEBUG, however, the output after doing this contains no useful information.

     16545:     find library=libsteam_api.so [0]; searching
     16545:      search cache=/etc/ld.so.cache
     16545:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     16545:       trying file=/lib/x86_64-linux-gnu/libsteam_api.so
     16545:       trying file=/usr/lib/x86_64-linux-gnu/libsteam_api.so
     16545:       trying file=/lib/libsteam_api.so
     16545:       trying file=/usr/lib/libsteam_api.so
     16545:
     16545:     find library=liblibsteam_api.so [0]; searching
     16545:      search cache=/etc/ld.so.cache
     16545:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     16545:       trying file=/lib/x86_64-linux-gnu/liblibsteam_api.so
     16545:       trying file=/usr/lib/x86_64-linux-gnu/liblibsteam_api.so
     16545:       trying file=/lib/liblibsteam_api.so
     16545:       trying file=/usr/lib/liblibsteam_api.so
     16545:
     16545:     find library=libsteam_api [0]; searching
     16545:      search cache=/etc/ld.so.cache
     16545:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     16545:       trying file=/lib/x86_64-linux-gnu/libsteam_api
     16545:       trying file=/usr/lib/x86_64-linux-gnu/libsteam_api
     16545:       trying file=/lib/libsteam_api
     16545:       trying file=/usr/lib/libsteam_api
     16545:
     16545:     find library=liblibsteam_api [0]; searching
     16545:      search cache=/etc/ld.so.cache
     16545:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     16545:       trying file=/lib/x86_64-linux-gnu/liblibsteam_api
     16545:       trying file=/usr/lib/x86_64-linux-gnu/liblibsteam_api
     16545:       trying file=/lib/liblibsteam_api
     16545:       trying file=/usr/lib/liblibsteam_api

Solution

  • Multiple dumb mistakes caused this issue, for one I had at some point renamed the library from "libsteam_api.so" to "libstream_api", and I was attempting to run the 32-bit library rather than the 64 bit one. Fixing naming, and switching to the correct one fixed the issue for me.