tonybolzan / snap-lorien

Snap Build for Lorien
0 stars 0 forks source link

Lorien failed to run when installed through snap. #1

Open fhvirus opened 2 years ago

fhvirus commented 2 years ago

I'm currently using Ubuntu 22.04 and I installed Lorien 0.5.0 from snap. However, nothing happens when I clicked the Lorien icon in Applications.

I tried to run Lorien with snap run lorien and I got the following error message:

Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
libGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
ERROR: Condition "ctxErrorOccurred || !p->glx_context" is true. Returned: ERR_UNCONFIGURED
   at: initialize (platform/x11/context_gl_x11.cpp:183)
ERROR: Error initializing GLAD
   at: is_viable (drivers/gles3/rasterizer_gles3.cpp:141)
Your video card driver does not support any of the supported OpenGL versions.
Please update your drivers or if you have a very old or integrated GPU, upgrade it.
If you have updated your graphics drivers recently, try rebooting.
Alternatively, you can force software rendering by running Godot with the `LIBGL_ALWAYS_SOFTWARE=1`
environment variable set, but this will be very slow.

and here's what I got by running lspci -k | grep -EA3 'VGA|3D|Display':

04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c2)
    DeviceName: AMD Radeon(TM) Graphics
    Subsystem: Hewlett-Packard Company Renoir
    Kernel driver in use: amdgpu

This seemed to be related to GPU, but when I try to run the executable downloaded from here on the same machine, Lorien just run as expected.

BorjaRuizReverter commented 9 months ago

This is because the shared libraries used by the snap executable /var/lib/snapd/snap/bin/lorien are not the same as those used by the bash script Lorien_v0.6.0_Linux/Lorien.x86_64.

In fact, on my machine (fedora39), after:

ldd /var/lib/snapd/snap/bin/lorien

it outputs:

linux-vdso.so.1 (0x00007ffc257eb000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fb41f707000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb41e41e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb41f738000)

and after:

ldd Lorien_v0.6.0_Linux/Lorien.x86_64

it returns:

linux-vdso.so.1 (0x00007ffc2b9de000)
libXcursor.so.1 => /lib64/libXcursor.so.1 (0x00007fdea8e66000)
libXinerama.so.1 => /lib64/libXinerama.so.1 (0x00007fdea8e61000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007fdea8e4d000)
libXrandr.so.2 => /lib64/libXrandr.so.2 (0x00007fdea8e40000)
libXrender.so.1 => /lib64/libXrender.so.1 (0x00007fdea8e34000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007fdea8ced000)
libXi.so.6 => /lib64/libXi.so.6 (0x00007fdea8cd8000)
libGL.so.1 => /lib64/libGL.so.1 (0x00007fdea8c51000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdea8c4c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fdea8c47000)
libm.so.6 => /lib64/libm.so.6 (0x00007fdea8b66000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdea8984000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdea8e93000)
libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007fdea897a000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fdea894f000)
libGLX.so.0 => /lib64/libGLX.so.0 (0x00007fdea891c000)
libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007fdea8864000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007fdea885e000)

This way, the libGL errors are likely due to the fact that libGL libraries are not loaded when executing Lorien via Snap.

BorjaRuizReverter commented 8 months ago

In any case, it seems that this repo doesnt correspond completely to the snap files that you can download and install from Lorien snapcraft.

In fact, the entry point to create the snap (the snapcraft.yaml hosted in this repo) is not the same as the snap.yaml that you have on /var/lib/snapd/snap/lorien/2/meta/ once you install Lorien via snap.

And here, precisely, is where this issue lies, because the snap.yaml file that comes with the snap installation (lorien 0.5.0 2 latest/edge) uses a shell script called snapcraft-runner (located at /var/lib/snapd/snap/lorien/2/snap/command-chain/) that does not load the ligGL libraries.

Particularly, this is because the snapcraft-runner script uses this path:

LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu"

rather than

LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu/dri"

since it is here ($SNAP/usr/lib/x86_64-linux-gnu/dri) where Lorien snap installs the shared objects:

Take note of this @tonybolzan and if you will:

  1. Update this repo as to host the same files that you can download from Lorien snap.
  2. Correct the issue I explain here.
tonybolzan commented 8 months ago

Hi @BorjaRuizReverter, the content of this repo are exactly the same I uploaded in Snapcraft. The snapcraft-runner are created by de Snapcraft v6, not by me.

Sorry if this build don't work in your machine, but this build are made a 2 years ago with the version 6 of snapcraft. I unlisted this package from Snap Store because I don't have time to upgrade this build to latest version of Lorien 6 neither Snapcraft 8, and at that moment I uses Fedora exclusively with Flatpak.

You can submit a PR to this repo with a updated version, and I will publish it with pleasure.

I donwloaded the file snap from store and compared it with the local file, in fact yaml are not exacly equal because snapcraft build change this file, and if you compare side-by-side you can see the file contains the same instructions, except the build instruictions.

curl -sS -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/lorien | jq
curl -sS "https://api.snapcraft.io/api/v1/snaps/download/eSWBTU2UoDCuZgzJHzM1e6wCbdFY2D6B_2.snap" -o "lorien.snap"
mkdir lorien
unsquashfs -d ./lorien lorien.snap