libGL.so1: Missing

Hello guys,

I try to make a snap with a prebuilt C++ app. If I open the app directly per console, it launches without a problem, but when I compile the snap, I get the following error:

$ orderheaven
/snap/orderheaven/x7/orderheaven: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

Structure of the folder snaptmp:

  • orderheaven # the executable
  • resources # the folder with the required resources

My snapcraft.yaml:

name: orderheaven
version: '3.0.0+Alpha9' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  orderheaven:
    # See 'snapcraft plugins'
    plugin: dump
    source: snaptmp

apps:
  orderheaven:
    command: orderheaven
    plugs: [opengl]

You’re not staging any dependency packages. All the libraries that your app depends upon need to be included in your snap or they’ll not be accessible. For the specific library mentioned in your error message you will want to add libgl1 to stage-packages.

parts:
  orderheaven:
    stage-packages:
    - libgl1
    ... # the rest of your part here

If the library is actually included in your pre-built package that you’re dumping into the snap then you need to find it’s location relative to your snap’s root folder and add that path to LD_LIBRARY_PATH:

apps:
  orderheaven:
    command: orderheaven
    environment:
      LD_LIBRARY_PATH: $SNAP/path/to/library-folder:$LD_LIBRARY_PATH
    plugs: [opengl]