How do people build Qt GUI applications snaps?

I am curios because from time to time I try and try snapcraft chances and fail miserable.
I use current Qt 5.9.x from the Qt repositories.
If I do not use desktop-qt5 I get:

QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.cumulus', please create it with 0700 permissions.
Qt: Session management error: None of the authentication protocols specified are supported
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Unrecognized OpenGL version
Unrecognized OpenGL version

If I do use desktop-qt5 I get crash because of a huge ppa fail…

Traceback (most recent call last):
File “/snap/snapcraft/794/lib/python3.6/site-packages/apt/cache.py”, line 452, in update
pulse_interval)
SystemError: W:The repository ‘http://ppa.launchpad.net/ubuntu-lxc/lxd-stable/ubuntu xenial Release’ does not have a Release file., W:Data from such a repository can’t be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch http://ppa.launchpad.net/ubuntu-lxc/lxd-stable/ubuntu/dists/xenial/main/binary-amd64/Packages 403 Forbidden, E:Some index files failed to download. They have been ignored, or old ones used instead.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/snap/snapcraft/794/bin/snapcraft”, line 11, in
load_entry_point(‘snapcraft==2.35’, ‘console_scripts’, ‘snapcraft’)()
File “/snap/snapcraft/794/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/snap/snapcraft/794/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2631, in load_entry_point
return ep.load()
File “/snap/snapcraft/794/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2291, in load
return self.resolve()
File “/snap/snapcraft/794/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2297, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/cli/main.py”, line 19, in
run(prog_name=‘snapcraft’)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 1043, in invoke
return Command.invoke(self, ctx)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/cli/init.py”, line 124, in run
ctx.forward(lifecyclecli.commands[‘snap’])
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 553, in forward
return self.invoke(cmd, **kwargs)
File “/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py”, line 140, in snap
project_options, directory=directory, output=output)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_packer.py”, line 45, in snap
execute(‘prime’, project_options)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py”, line 80, in execute
_Executor(config, project_options).run(step, part_names)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py”, line 175, in run
self._run_step(step, part, part_names)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py”, line 205, in run_step
getattr(part, 'prepare
{}’.format(step))()
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/init.py”, line 244, in prepare_pull
self._fetch_stage_packages()
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/init.py”, line 230, in _fetch_stage_packages
stage_packages)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/repo/_deb.py”, line 293, in get
with self._apt.archive(self._cache.base_dir) as apt_cache:
File “/snap/snapcraft/794/usr/lib/python3.6/contextlib.py”, line 82, in enter
return next(self.gen)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/repo/_deb.py”, line 141, in archive
raise e
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/repo/_deb.py”, line 132, in archive
apt_cache = self._setup_apt(cache_dir)
File “/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/repo/_deb.py”, line 125, in _setup_apt
sources_list=sources_list_file)
File “/snap/snapcraft/794/lib/python3.6/site-packages/apt/cache.py”, line 454, in update
raise FetchFailedException(e)
apt.cache.FetchFailedException: W:The repository ‘http://ppa.launchpad.net/ubuntu-lxc/lxd-stable/ubuntu xenial Release’ does not have a Release file., W:Data from such a repository can’t be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch http://ppa.launchpad.net/ubuntu-lxc/lxd-stable/ubuntu/dists/xenial/main/binary-amd64/Packages 403 Forbidden, E:Some index files failed to download. They have been ignored, or old ones used instead.

You can look at how the Keepassxc people are doing it:
https://github.com/keepassxreboot/keepassxc/blob/develop/snapcraft.yaml

I think that they use a custom redefine of the desktop-qt5 stage packages because they want a more updated version of QT than the one that comes with Ubuntu 16.04, and they use Ubuntu 17.04 to build the snap.

Another option would be to do what @lucyllewy suggests here:

I think he’s referring to what he does here, but I’m not really sure:

2 Likes

Yes that is exactly what I was referring to :slight_smile:

This is how I recently built my QT5 lxi-tools snap:

The only downside is that the QT5 widgets/theme does not look that good because it’s based on the Ubuntu 16.04 LTS core image. The lxi-gui application looks better when natively built on e.g. Ubuntu 17.10. I’m not sure if there is a way to mitigate this - maybe easier to wait for an updated core image based on Ubuntu 18.04 LTS.

1 Like