Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to launch game due to missing libraries #19

Closed
SSalekin opened this issue May 23, 2022 · 18 comments · Fixed by #33
Closed

Failed to launch game due to missing libraries #19

SSalekin opened this issue May 23, 2022 · 18 comments · Fixed by #33
Labels
type/bug Something isn't working

Comments

@SSalekin
Copy link

SSalekin commented May 23, 2022

How to reproduce

sudo snap refresh snapd --beta
sudo snap install steam --beta

os: freshly installed ubuntu 22.04
game: Northgard (native linux build)

the game crashes at launch, running from the terminal shows this error

GameAction [AppID 466560, ActionID 1] : LaunchApp changed task to Completed with ""
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libpulse.so.0
** ERROR ** Missing library libX11.so.6
** ERROR ** Missing library libXext.so.6
** ERROR ** Missing library libXcursor.so.1
** ERROR ** Missing library libXinerama.so.1
** ERROR ** Missing library libXi.so.6
** ERROR ** Missing library libXrandr.so.2
** ERROR ** Missing library libXss.so.1
** ERROR ** Missing library libXxf86vm.so.1
** ERROR ** Missing library libwayland-egl.so.1
** ERROR ** Missing library libwayland-client.so.0
** ERROR ** Missing library libwayland-cursor.so.0
** ERROR ** Missing library libxkbcommon.so.0
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libpulse.so.0
** ERROR ** Missing library libX11.so.6
** ERROR ** Missing library libXext.so.6
** ERROR ** Missing library libXcursor.so.1
** ERROR ** Missing library libXinerama.so.1
** ERROR ** Missing library libXi.so.6
** ERROR ** Missing library libXrandr.so.2
** ERROR ** Missing library libXss.so.1
** ERROR ** Missing library libXxf86vm.so.1
** ERROR ** Missing library libwayland-egl.so.1
** ERROR ** Missing library libwayland-client.so.0
** ERROR ** Missing library libwayland-cursor.so.0
** ERROR ** Missing library libxkbcommon.so.0
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libpulse.so.0
** ERROR ** Missing library libX11.so.6
** ERROR ** Missing library libXext.so.6
** ERROR ** Missing library libXcursor.so.1
** ERROR ** Missing library libXinerama.so.1
** ERROR ** Missing library libXi.so.6
** ERROR ** Missing library libXrandr.so.2
** ERROR ** Missing library libXss.so.1
** ERROR ** Missing library libXxf86vm.so.1
** ERROR ** Missing library libwayland-egl.so.1
** ERROR ** Missing library libwayland-client.so.0
** ERROR ** Missing library libwayland-cursor.so.0
** ERROR ** Missing library libxkbcommon.so.0
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libpulse.so.0
** ERROR ** Missing library libX11.so.6
** ERROR ** Missing library libXext.so.6
** ERROR ** Missing library libXcursor.so.1
** ERROR ** Missing library libXinerama.so.1
** ERROR ** Missing library libXi.so.6
** ERROR ** Missing library libXrandr.so.2
** ERROR ** Missing library libXss.so.1
** ERROR ** Missing library libXxf86vm.so.1
** ERROR ** Missing library libwayland-egl.so.1
** ERROR ** Missing library libwayland-client.so.0
** ERROR ** Missing library libwayland-cursor.so.0
** ERROR ** Missing library libxkbcommon.so.0
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libasound.so.2
** ERROR ** Missing library libpulse.so.0
** ERROR ** Missing library libX11.so.6
** ERROR ** Missing library libXext.so.6
** ERROR ** Missing library libXcursor.so.1
** ERROR ** Missing library libXinerama.so.1
** ERROR ** Missing library libXi.so.6
** ERROR ** Missing library libXrandr.so.2
** ERROR ** Missing library libXss.so.1
** ERROR ** Missing library libXxf86vm.so.1
** ERROR ** Missing library libwayland-egl.so.1
** ERROR ** Missing library libwayland-client.so.0
** ERROR ** Missing library libwayland-cursor.so.0
** ERROR ** Missing library libxkbcommon.so.0
** ERROR ** Missing library libasound.so.2
sh: 1: notify-send: not found
src/module.c(373) : FATAL ERROR : Failed to load library sdl.hdll
Game process removed: AppID 466560 "/home/salekin/snap/steam/common/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=466560 -- '/home/salekin/snap/steam/common/.local/share/Steam/steamapps/common/Northgard/linux/run.sh'", ProcID 84391 
ThreadGetProcessExitCode: no such process 84393
ThreadGetProcessExitCode: no such process 84392

How do I add those missing libraries ? thanks 🙇

Edit

Here are the connections for snap

snap connections steam


Interface               Plug                          Slot                            Notes
audio-playback          steam:audio-playback          :audio-playback                 -
audio-record            steam:audio-record            -                               -
bluez                   steam:bluez                   -                               -
content[gtk-3-themes]   steam:gtk-3-themes            gtk-common-themes:gtk-3-themes  -
content[icon-themes]    steam:icon-themes             gtk-common-themes:icon-themes   -
content[sound-themes]   steam:sound-themes            gtk-common-themes:sound-themes  -
desktop                 steam:desktop                 :desktop                        -
desktop-legacy          steam:desktop-legacy          :desktop-legacy                 -
fuse-support            steam:fuse-support            -                               -
gsettings               steam:gsettings               :gsettings                      -
hardware-observe        steam:hardware-observe        -                               -
home                    steam:home                    :home                           -
joystick                steam:joystick                -                               -
mount-observe           steam:mount-observe           -                               -
network                 steam:network                 :network                        -
network-control         steam:network-control         -                               -
opengl                  steam:opengl                  :opengl                         -
personal-files          steam:dot-local-share-steam   -                               -
process-control         steam:process-control         -                               -
removable-media         steam:removable-media         -                               -
screen-inhibit-control  steam:screen-inhibit-control  :screen-inhibit-control         -
shared-memory           steam:shared-memory           :shared-memory                  -
steam-support           steam:steam-support           :steam-support                  -
system-observe          steam:system-observe          -                               -
wayland                 steam:wayland                 :wayland                        -
x11                     steam:x11                     :x11                            -
@ashuntu ashuntu added the type/bug Something isn't working label May 27, 2022
@SJSalekin
Copy link

More than a month and yet no reply. Am I asking the question wrong or something (not sarcasm)

@sergio-costas
Copy link
Contributor

Have you tried to refresh the snap?

Also, when are those messages shown? When launching the snap? When launching the game?

@SJSalekin
Copy link

@sergio-costas I'm answering you from my work git acc. Sorry for this confusion.

have you tried refreshing snap

Yes, I also tried both beta and edge snap versions. Didn't work for any of them.

Note, the game runs flawlessly on native steam .deb installation

when does the error show
The error occurs when you try to launch the game. The game would immediately close. To understand what's making the game fail to run, I tried running the steam snap through terminal, then paste the error log above.

@sergio-costas
Copy link
Contributor

Yes, but I mean: does the "Missing library..." messages appear as soon as you launch steam snap from the terminal, or do they appear when you try to launch the game? What about "FATAL ERROR : Failed to load library sdl.hdll"? Does it appear immediately after launching Steam, or when you press the button to launch the game?

@SJSalekin
Copy link

@sergio-costas Just as I try to launch the game. Not during launching steam.

@ashuntu
Copy link
Collaborator

ashuntu commented Jun 29, 2022

Just for testing purposes, could you try snap refresh snapd --edge and restarting Steam?

Also, is this only for Northgard or does it happen for every game?

@SJSalekin
Copy link

@ashuntu I tested it with steam --edge but haven't tested with snapd --edge, I'll test it when I go back home.

The only other game I tested was DoTA, which runs flawlessly. I don't play any other games than DoTA and Northgard, but I can maybe test with some free games on steam in the weekend.

@jhenstridge
Copy link
Contributor

jhenstridge commented Jun 30, 2022

@SJSalekin: I suspect that the game you're running is 32-bit. We've got 64-bit versions of those libraries in the snap, but not the 32-bit equivalents. To help verify, could you run the following on your system:

find ~/snap/steam/common/.local/share/Steam/steamapps/common/Northgard/linux -type f -executable -exec file {} +

I would have thought the libraries from the steam-runtime tarball Steam downloads would have provided all these, but perhaps we need to include them in the snap too.

@ashuntu: if this turns out to be the case, do you need any help to try adding these?

@SJSalekin
Copy link

@jhenstridge After running your command

northgard executable is called hl for some reason

find hl -type f -executable -exec file {} +

hl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=bbc0c516ac6c8be4f605cda6a209b55b06da46f8, not stripped
objdump -f hl | grep ^architecture

architecture: i386:x86-64, flags 0x00000112:

@ashuntu snapd --edge didn't solve the issue

🙇

@jhenstridge
Copy link
Contributor

Okay. Then my guess that it is a 32-bit executable was incorrect. We should already have copies of at least some of the libraries it is complaining about.

Could you provide a copy of ~/snap/steam/common/.local/share/Steam/steamapps/common/Northgard/linux/run.sh? Maybe upload a copy to a pastebin site like https://paste.ubuntu.com/ and include the link here. I'm wondering if the script does something weird to LD_LIBRARY_PATH, and I don't have a copy of this game to check myself.

@SJSalekin
Copy link

SJSalekin commented Jun 30, 2022

@jhenstridge Just 2 lines inside

cat steamapps/common/Northgard/linux/run.sh

LD_PRELOAD= LD_LIBRARY_PATH=linux ./linux/hl linux/detect.hl
LD_PRELOAD= LD_LIBRARY_PATH=linux ./linux/hl sdlboot.dat "$@"

So, it's preloading the contents of ./linux , right ?
those libraries are inside that folder
Screenshot from 2022-06-30 20-11-04

List of the files:

detect.hl               libmbedtls.so         libturbojpeg.so.0
fmt.hdll                libmbedtls.so.10      libuv.so.1
hl                      libmbedtls.so.2.2.1   libvorbis.so.0
libSDL2-2.0.so          libmbedx509.so        libvorbisfile.so.3
libSDL2-2.0.so.0        libmbedx509.so.0      mysql.hdll
libSDL2-2.0.so.0.4.0    libmbedx509.so.2.2.1  openal.hdll
libSDL2.so              libogg.so.0           run.sh
libbsd.so.0             libopenal.so.1        sdl.hdll
libhl.so                libpng16.so.16        ssl.hdll
libmbedcrypto.so        libsndio.so           steam.hdll
libmbedcrypto.so.0      libsndio.so.6.1       ui.hdll
libmbedcrypto.so.2.2.1  libsteam_api.so       uv.hdll

@lucyllewy
Copy link

These two lines:

LD_PRELOAD= LD_LIBRARY_PATH=linux ./linux/hl linux/detect.hl
LD_PRELOAD= LD_LIBRARY_PATH=linux ./linux/hl sdlboot.dat "$@"

are explicitly removing any preload configuration and explicitly setting the library search path to only the linux subdirectory. This means that inside a snap where we make liberal use of the LD_LIBRARY_PATH to tell apps where the snap's libraries are located that this configuration will override ours and cause the app to fail.

Aside: The hl name comes from the fact that Northguard is written in the Haxe programming language and they have chosen to compile and run the code for the Hashlink virtual machine (think of it like .NET Core where you can run your app with the command dotnet myapp.dll), which is spawned using the hl executable containing the runtime of Hashlink.

@SJSalekin
Copy link

SJSalekin commented Jun 30, 2022

@diddledani So, there is no fix for this unless the Northgard devs change their run.sh or I manually edit it, right ?

I am noob to this, so would you please suggest an edited version of the file which won't exclude the libraries provided by snap 🙇

Thanks for letting me know about the Haxe programming language, I never heard of it before

@jhenstridge
Copy link
Contributor

Okay, so it is overriding the LD_LIBRARY_PATH rather than adding new directories to it. That means it sees neither the libraries provided by the snap, or those provided by the steam runtime.

I've got some ideas about how we can handle this, but it needs a bit more experimentation.

@SJSalekin
Copy link

@jhenstridge

That means it sees neither the libraries provided by the snap, or those provided by the steam runtime.

In that case, shouldn't it also fail for the .deb version of steam ?

@everyone Thank you so much for your time and the helps. I really appreciate your support 🙇

@jhenstridge
Copy link
Contributor

In that case, shouldn't it also fail for the .deb version of steam ?

No. At the core of it, there are two ways that an executable finds its libraries:

  1. if the LD_LIBRARY_PATH environment variable is set, each directory specified there is checked in turn to see if it contains the named library.
  2. if the library still hasn't been found, the /etc/ld.so.cache file is consulted to find the libraries. This cache is built by the ldconfig program, which scans for libraries in the directories named in /etc/ld.so.conf and /etc/ld.so.conf.d/*.conf.

Both the Steam snap and Steam's own steam-runtime download are using LD_LIBRARY_PATH to make the libraries available. This particular game's launcher shell script resets the environment variable though, so only libraries in ld.so.cache can be found.

In the .deb case this is fine, because the libraries in question can be found that way (assuming they're actually installed). In the snap case, we're running in a clean environment (in essence, the contents of /snap/core20/current/ is used as the root file system), and the missing libraries aren't available in /usr/lib.

My idea of how to solve this problem is to have the snap build its own copy of ld.so.cache that includes the libraries found in /snap/steam/current/. That should allow the game to run even though it overrides LD_LIBRARY_PATH.

@SJSalekin
Copy link

SJSalekin commented Jul 15, 2022

I see the PR has been merged, when can I test it ? I've the steam --edge snap, but it's still having the same issue

Again, thank you so much 🙇

@jhenstridge
Copy link
Contributor

@SJSalekin: it should be available on edge now (rev 32). There is a bit of a delay between the PR being merged to main and the snap being built and published to edge.

If you're still getting the same missing libraries error, please reopen this issue. If you run into an entirely different problem with the game, please file a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants