Having trouble understanding snap packaging

I want to learn making snap packages but I have a very rough time understanding it. I’m on my 3rd attempt, hopefully 3rd is a charm.

My test package is a simple Qt Quick Controls2 Hello World application(the basic you get for new project), but have no ideea how to package it.

Building it from scratch isn’t worth it since it’s pulling an entire OS to build it, it doesn’t use the Qt version I need because the Ubuntu 16.04 repositories contains Qt 5.5(or 5.6, can’t remember), it doesn’t seem to download packages for other version of Qt even though I tell snapcraft to build with qt59(from ppa) by putting those qt59 packages in build section of the part.

I tried dump plugin but it it works weird and still the application won’t run, I add organize attribute but it copies the files directories 2 times, once it goes and copy everything from the directory where the snapcraft.yaml lies but also those which I mention in organize.

I have managed to make a structure to dump everything but when I run the application it says:

QStandardPaths: XDG_RUNTIME_DIR points to non-existing path ‘/run/user/1000/snap.snap-test’, please create it with 0700 permissions.
Qt: Session management error: Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed

Here is the snapcraft.yaml file for it:

name: snap-test
version: 1.0.0
summary: snap test
description: |
  test snapcraft
grade: devel
confinement: devmode

    plugin: dump

    command: usr/bin/snap-test

I have read the doc start to end a couple of times, and seems easy until I get into building it…then nothing I do works.

I need to deploy the binary, the libraries, the qml files and the plugins needed for the apps to run.

1 Like

I think you want your apps section to be above your parts section. Also you can put source: http://google.com/ (replacing Google with the source URL) under plugin: dump to get the source. Otherwise I think you need source: . to say you just want to use what’s in your current directory.

Also you probably want to be basing your snapcraft.yaml on this one for a Qt5 application? Maybe that helps :slight_smile:

Also there’s this article here that may be of use.

Thanks for the answer, will look into it and hopefully tommorrow I get a chance too implement it.
In command I saw in non-Qt applications “desktop-launch”, but I remember I got an error whenever I had it in command.

The desktop-launch commands are installed when you include after: [desktop-qt5] or after: [desktop-gtk3] in your part’s specification. Those are special parts which are available for snapcraft to download and install into your snap automatically.

Reference on the desktop parts is currently hidden in the wiki on a user-unfriendly page, and the source code of them is in github if you want to understand what the desktop-launch script does (the part will combine several files in the github into the single desktop-launch script).

1 Like