Scroll to TL;DR; to get to actual problem
I am trying to package our open source project using snapcraft, but given lack of examples for this kind of software I am having big troubles getting it to work.
Basically, it’s a C++ Qt4 / Qt5 application (can be compiled on both) with either WebKit or WebEngine, it has massive dependency tree, and consist of at least 8 separate binaries that need to be packaged together in a proper way so that it works.
I want packaging to be simple stupid, so that nobody who is doing the actual packaging needs to know ANYTHING about snaps. Basically I wanted to create a simple shell script that anyone can execute on Ubuntu and it produces a working snap, this shell script can be found here: https://github.com/huggle/huggle3-qt-lx/blob/snapfix/linux/snap/generate_snap.sh
That script will create a folder “tmp”, copy source code inside as well as snapcraft.yml and prepare it - I had some serious issues getting Qt plugins to work so I had to create a symlink inside of snap tree, which actually fixed it, that is visible in script.
The snapcraft.yml is IMHO looking pretty ugly, but it seems that removing anything from it will make it produce package that doesn’t run at all as libraries / dependencies are missing from it.
Now with this script and yaml file I am able to create actual snap file that can be installed and my application started, and all binaries seems to be packaged on proper places where it finds them, but it segfaults right when it tries to intialize first QtWidget (First window of application). Like if confining somehow prevented it from running properly?
TL;DR; I am able to package my program, but it doesn’t start - it’s getting segfault when it tries to create a QtWidget (window), I don’t know where exactly it crashes because I can’t figure out how to attach debugger to my application through that wrapper binary that is provided by snap.
Anyone has a clue what is wrong or how to do it right so that it works? Application, if compiled and not packaged by snap runs with no problems.
Here is the yaml file:
name: huggle
version: "3.2.0"
summary: Diff browser for MediaWiki based websites intended to deal with vandalism
description: Diff browser for MediaWiki based websites intended to deal with vandalism
confinement: strict
icon: src/Resources/huggle3_newlogo.png
epoch: 0
grade: stable
apps:
huggle:
command: huggle
plugs:
- unity7
- x11
- network
- home
- opengl
- pulseaudio
- browser-support
parts:
application:
plugin: cmake
configflags:
- -DQT5_BUILD=true
- -DLINUX_SNAP=true
- -DHUGGLE_EXT=true
source: src/
stage-packages:
- libqt5gui5
- libqt5core5a
- libqt5webkit5
- libqt5concurrent5
- libqt5quickparticles5
- libqt5widgets5
- libqt5declarative5
- libqt5quickwidgets5
- libqt5network5
- libqt5multimediaquick-p5
- libqt5multimediawidgets5
build-packages:
- libgtk2.0-0
- libdrm-dev
- libegl1-mesa-dev
- qtbase5-dev
- libgl1-mesa-dev
- libglu1-mesa-dev
- libqt5opengl5-dev
- libwayland-dev
- libx11-dev
- qtmultimedia5-dev
- libqt5webkit5-dev
after: [desktop-qt5]