electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Snap package searching for libgl files in wrong path

Open cheynewallace opened this issue 4 months ago • 1 comments

  • Electron-Builder Version: 24.9.1
  • Node Version: v20.9
  • Electron Version: 27.2.2
  • Electron Type (current, beta, nightly): current
  • Target: Linux arm64

I have noticed that my app is running terribly on the Raspberry Pi devices we often use, so we did some digging and discovered the chromium windows are running with all GPU acceleration disabled. Looking at the logs of the app starting I see a bunch of errors about being unable to load video drivers, such as

libGL error: MESA-LOADER: failed to open vc4: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/104/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open vc4: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/104/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open swrast: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/104/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast

After some investigation, and reading: https://forum.snapcraft.io/t/adding-opengl-gpu-support-to-a-snap/6273 we added libglu1-mesa to the stage packages, which DOES seem to add the files into the $SNAP/usr/lib/aarch64-linux-gnu/dri path except that as you can see from the log above, the app is looking in the directory $SNAP/gnome-platform...

There is nothing in the directory $SNAP/gnome-platform .. its empty, the driver files are available at $SNAP/usr/lib/aarch64-linux-gnu/dri but I cannot seem to get electron builder to use this path with the final snap output.

This is running on Raspberry Pi OS also, so im not even sure if "gnome-platform" is correct here. Seems to be the default.

I have tried overwriting the LD_LIBRARY_PATH var, with LD_LIBRARY_PATH: $SNAP/usr/lib/aarch64-linux-gnu/dri:$LD_LIBRARY_PATH. but that just broke everything.

iv tried specifying LIBGL_DRIVERS_PATH directly in the env vars and that didnt help either.

its attempting to load library files from an empty path, when the files are available in a directory right next to it. Im not sure if this is a bug but something seems wrong.

More context and full snap logs can be found on another post iv made on the snapcraft forums here: https://forum.snapcraft.io/t/electron-snap-gpu-hardware-acceleration-disabled/38902

cheynewallace avatar Feb 12 '24 04:02 cheynewallace

I think this change would require changes to upstream npm package https://github.com/develar/app-builder as we use that for compilation of snap packages. It's either that or electron itself has a bug? electron-builder doesn't have any configuration IIRC for what is loaded at runtime for snap

mmaietta avatar Mar 18 '24 16:03 mmaietta