Error: Kivy, Snapcraft, and missing i965/swrast drivers

I am trying to package a Python 3 Kivy application with Snapcraft, and I’ve gotten pretty far. However, while it build successfully, when I run the application, I get the following errors:

libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

I’ve seen some discussion about this, including one topic here that said to add libgl1-mesa-dri to the stage packages (yes, I’m on a 64-bit Intel system), but the errors persist. A little ways below is the full text of my snapcraft.xaml and setup.py.

How do I fix this?

snapcraft.xaml

name: omission # you probably want to 'snapcraft register <name>'
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: A deceptively simple word puzzle. # 79 char long summary
description: |
  Omission challenges you to put your language detective skills to the test with
  a deceptively simple challenge - Find the missing letter! A famous quotation
  will be displayed, with all the instances of a single letter removed. How fast
  can you figure out the missing letter? It's a race to beat the clock (unless
  you choose another mode) as you try to complete as many passages as you can.
  The faster you answer, the more points you gain.

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

parts:
  omission:
    # See 'snapcraft plugins'
    plugin: python
    python-version: python3
    source: .
    stage-packages:
        - build-essential
        - git
        - python3-dev
        - ffmpeg
        - libsdl2-dev
        - libsdl2-image-dev
        - libsdl2-mixer-dev
        - libsdl2-ttf-dev
        - libportmidi-dev
        - libswscale-dev
        - libavformat-dev
        - libavcodec-dev
        - zlib1g-dev
        - libgstreamer1.0-0
        - libgstreamer1.0-dev
        - gstreamer1.0-plugins-base
        - gstreamer1.0-plugins-good
        - libmtdev1
        - libgl1-mesa-dri # libgl1-mesa-glx for x86, libgles2-mesa for ARM
        - cython3

apps:
    omission:
        command: bin/omission

setup.py

#!/usr/bin/env python

from setuptools import setup

setup(name='Omission',
      version='1.0',
      description='A deceptively simple word puzzle.',
      author='MousePaw Games',
      author_email='info@mousepawgames.com',
      url='https://www.mousepawgames.com/omission',
      license='BSD-3',
      packages=['omission',
                'omission.data',
                'omission.game',
                'omission.interface'],
      entry_points={'gui_scripts': ['omission = omission.__main__:main']},
      install_requires=[
          'cython == 0.25.2',
          'kivy >= 1.10.0',
          'appdirs >= 1.4.3'
          ],
      classifiers=[
          'Development Status :: 5 - Production/Stable',
          'Intended Audience :: End Users/Desktop',
          'License :: OSI Approved :: BSD License',
          'Natural Language :: English',
          'Operating System :: Microsoft :: Windows',
          'Operating System :: MacOS :: MacOS X',
          'Operating System :: POSIX :: Linux',
          'Programming Language :: Python :: 3',
          'Topic :: Games/Entertainment :: Puzzle Games'
          ]
     )

You may need to use a launcher to setup the environment.

See the one I used in the love2d snapcraft template for example. There’s a few GL related variables in there which need to be set. Either copy them to a launcher of your own or just duplicate that launcher in its entirety and modify the last line.

apps:
  omission:
    command: bin/omission

you didnt allow the app to use the opengl interface …

Thanks @popey , it looks like that fixed it.

1 Like

Mission accomplished!

I’ve incorporated that (with credit) into a dev.to article detailing how to package with Kivy and Snapcraft, entitled “Python Application Packaging Pt. 1 (or How to Beat Yourself With a Wet Fish and Survive)”. Feedback welcome, OFC, as I’m no Snapcraft expert.