Sqlitebrowser couldn't find Qt platform plugin "xcb"

Hi,

I am snapcraft newbie. I am building snap package for DB browser for sqlite (sqlitebrowser). I can run the binary from “/snap/sqlitebrowser/bin/” directory. But global “sqlitebrowser” give me error.

This application failed to start because it could not find or load the Qt platform plugin "xcb".

Reinstalling the application may fix this problem.
Aborted

Here is my snapcraft.yaml file.

 name: sqlitebrowser  # the name of the snap
version: 0.1  # the version of the snap
summary: DB browser for Sqlite  # 79 char long summary
description: GUI editor for SQLite databases  # a longer description for the snap
confinement: devmode  # use "strict" to enforce system access only via declared interfaces

grade: devel
confinement:        devmode
icon:               snap/sqlitebrowser.svg
type:               app

apps:
  sqlitebrowser:
    command: bin/sqlitebrowser
    desktop: share/applications/sqlitebrowser.desktop

build-packages:
    - build-essential
    - g++
    - qtbase5-dev
    - qttools5-dev
    - qttools5-dev-tools
    - libsqlite3-dev
    - cmake
    - libantlr-dev
    - libqcustomplot-dev
parts:
    sqlitebrowser:  # Replace with a part name of your liking
    # Get more information about plugins by running
    # snapcraft help plugins
    # and more information about the available plugins
    # by running
    # snapcraft list-plugins plugin autotools
        source-type: git
        plugin: cmake
        source: https://github.com/sqlitebrowser/sqlitebrowser.git

    dump:  # Replace with a part name of your liking
    # Get more information about plugins by running
    # snapcraft help plugins
    # and more information about the available plugins
    # by running
    # snapcraft list-plugins plugin autotools
        plugin: dump
        after:
        - sqlitebrowser
        stage-packages:
        - qtbase5-dev
        - qttools5-dev
        - qttools5-dev-tools
        - libsqlite3-dev
        - libantlr-dev
        - libqcustomplot-dev
        - libx11-xcb1
        - libx11-xcb-dev
        - libxcb-icccm4-dev
        - libxcb-image0-dev
        - libxcb-keysyms1-dev
        - libxcb-randr0-dev
        - libxcb-render-util0-dev
        - libxcb-render0-dev
        - libxcb-shape0-dev
        - libxcb-shm0-dev
        - libxcb-sync-dev
        - libxcb-xfixes0-dev
        - libxcb-xinerama0-dev
        - libxcb-xkb-dev
        - libxcb1-dev
        filesets:
            wanted:
            - etc/*
            - lib/*
            - usr/lib/x86_64-linux-gnu/*
            - usr/lib/*
            - share/icons/hicolor/256x256/apps/*
            - lib/x86_64-linux-gnu/* 
            - usr/lib/x86_64-linux-gnu/mesa/* 
        prime:
        - $wanted

I will appreciate any help!!

Hey, you need a launcher script to set some environment variables in order to make your application find the Qt libraries you’re shipping with. Take a look at https://github.com/ubuntu/snapcraft-desktop-helpers and snapcraft define desktop-qt5.

2 Likes

Thanks for the reply. Are these paths supposed to be relative according to snap package. For example if path the snap is “/snap/sqlitebrowser/current/” , so either i can define path “lib/qt5” or absolute “/snap/sqlitebrowser/current/lib/qt5”. or are there any other ways to share common libs ??

Now i am getting following error.

snapcraft cleanbuild
Traceback (most recent call last):
File “/usr/bin/snapcraft”, line 9, in
load_entry_point(‘snapcraft==2.34’, ‘console_scripts’, ‘snapcraft’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2569, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2229, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/snapcraft/cli/main.py”, line 19, in
run(prog_name=‘snapcraft’)
File “/usr/lib/python3/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py”, line 188, in cleanbuild
lifecycle.cleanbuild(project_options, remote)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py”, line 318, in cleanbuild
config = snapcraft.internal.load_config(project_options)
File “/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/init.py”, line 24, in load_config
return Config(project_options)
File “/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/_config.py”, line 124, in init
snapcraft_yaml=self.snapcraft_yaml_path)
File “/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/_parts_config.py”, line 55, in init
self._process_parts()
File “/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/_parts_config.py”, line 85, in _process_parts
self.load_part(part_name, plugin_name, properties)
File “/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/_parts_config.py”, line 201, in load_part
part.source_handler.command)
TypeError: unsupported operand type(s) for |=: ‘set’ and ‘NoneType’

What paths do you mean? Can you explain in a bit more detail what you did?

Now i am getting following error.

Can you share what you changed in your snapcraft.yaml?

1 Like

This worked. There was some problem with my snapcraft installation that’s why i was unable to build it from past few months. Gave it a try yesterday, it worked like a charm.

Thanks !!

2 Likes