Qt/QML on Ubuntu Core


#1

Hello everybody.
I collected a snap package with an application written on Qt/QML, also in the application there is a kernel to which graphics are connected to manage this kernel.
Snap package is installed and works both on Ubuntu and on other distributions.
Now I’m trying to get this project to work on Ubuntu-core.
As I understood from these articles:

http://www.lieberbiber.de/2017/02/27/mir-and-graphics-on-ubuntu-core/
http://voices.canonical.com/alan.griffiths/2016/12/03/mircade/

I will need a mir-kiosk with the help of which this project will work.
Below I throw off 2 files:

  1. is snapcraft.yaml of the whole application, in it by the names you can see where the kernel is and where the graphic parts.
    https://www.dropbox.com/s/pz8sbw3afqbkuh5/snapcraft.yaml?dl=0

  2. file is a standard desktop-launch. I just added lines at the end of the file where you need to search for the necessary Qt libraries and modules for the application.
    https://www.dropbox.com/s/3rw1nxqk3fwao0i/run.sh?dl=0

I would be very grateful if someone would advise what else to plug into the project or add it to the snapcraft.yaml file.
I accept any help)

And an additional question to those who created scripts for demons, someone could show their example to understand how and with what such script works. I want to understand how to launch the kernel in applications as a demon.
Thank you in advance for your advice.


#2

The canonical example of a Qt snap is being discussed on another thread: Ubuntu Core, Raspberry Pi and Qt.

That example works on Ubuntu Core and shows how to launch a Qt application. To help diagnose your problem you could simplify your snap to run a test application that doesn’t need a demon and confirm that you can replicate this.

Can you explain the step that fails for you? What are you doing differently from that example? What are you trying to achieve by doing that? And what error(s) are logged?


#3

Thanks for answering.
At the moment snap when I install it on a normal Linux distribution works like this:
1: command bsp095project.BSP095launcherCoreSimulation
Runs applications kernel in emulation modes, that is, it launches and a graphical window for testing. This kernel creates 2 files with keys in the user’s directory.
2: command bsp095project.BSP095launcherCore
Runs a kernel that does not already work in emulation modes, must run as a service on the system. As planned, it should start as a daemon, when launched as well as the simulation kernel creates 2 files with keys in the user’s directory.
3: command bsp095project.BSP095launcherGui
Graphical application, works with one of kernels, connects to them on the created 2 keys in the files. That is, only after the kernel has created the files with the keys, only after that the given application can connect to the kernel.

As I wrote, the snap package works in Linux, but if I try to run on Ubuntu-core then I see error:

As I understand now, you need to add work with the Mir and the mir-kiosk.


#4

It is extremely hard to follow you with this use of terminology, a kernel is typically the very core part of the OS (see this explanation) which in our case is “Linux” …

That parts of your app are called core while running on Ubuntu Core (which also ships a core snap as its root filesystem) doesnt make it easier to tell apart what you are talking about …

That said … i suspect your app is designed for X11 and might need some changes before being able to run on mir or wayland …

I also think the “after: [desktop-qt5]” stanza in your snapcraft.yaml forces the snap environment to use/expect X11 availability, try dropping it when you set up your snapcraft.yaml for Mir (X11 is only available on classic desktop installs, but not on Ubuntu Core (for security reasons)).

Take a look at the mir-kiosk-apps snapcraft.yaml (linked from the article that @alan_g pointed to above) for some idea how you need to set up the mir-libs plug in your snap…


#5

Sorry about my terminology. I tried to write as we have an application named and running. When I wrote a simple core, I had a mind of the core of the application that goes into the snap and is intended for graphical part work. Otherwise it is not write.


#6

I followed your advice, deleted line after: [desktop-qt5], added to the plugs: Mir, mir-libs, added to snapcraft

plugs:
    mir-libs:
        interface: content
        content: mir0
        target: mir-libs
        default-provider: mir-libs:mir-libs

But I see this:
####################################################################"
“ERROR: It appears ${SNAP_NAME}:mir-libs plug has not been connected.”
“Please run:”
""
" snap install mir-libs --edge"
" snap connect ${SNAP_NAME}:mir-libs mir-libs:mir-libs"
""
"###################################################################"

I have installed mir-libs.
But if I try to write in terminal snap connect bsp095project: () Next in the choice of options does not show the ability to connect the mir-libs or mir
As I understand I still have something missing in snapсraft.yaml.
I’m throwing the latest version.


Correct me please if I’m mistaken in something.

Thx.


#7

have you checked with “snap interfaces” what interfaces your snap exposes ?
also make sure to have the mir snap itself installed … (your core device should come up with a black screen and a mouse cursor if that is the case)


#8


In Ubuntu-core I have installed all from this http://www.lieberbiber.de/2017/02/27/mir-and-graphics-on-ubuntu-core/
And the kiosk together with the game is launched. But in my case, it does not work that way.


#9

I used a script that was with a package of mircade that I run without problems.
I took this script and commented on something that I think don’t need and added lines for Qt that exactly what my project need.

But how I understand what it lacks. I will be grateful for the correction.
I really do not understand what this script should do to run the application (((

Thx.


#10
  1. I’m not going to try to decipher your screenshot beyond the first few lines.
  2. Luckily, the first part of your screenshot looks like a clue.

PS You are making it hard for people to help you. If you keep that up we will stop trying. So…

  1. Learn how to ask good questions.

#11

The run.sh script is to make it run under X11 once again, i doubt this helps in any way on UbuntuCore …

If your screenshot is from an Ubuntu Core install, then mir did obviously not start … (remember, black screen and mouse cursor should be what you see) … try to get that going first (without your app running)


#12

Yes, it’s screenshot from Ubuntu-core.


#13

so make sure to get mir-kiosk to run standalone first … following the howto that alan linked above … only then start to work on your app and try to make it run on top of this.


#14

Yep, you first need to get Mir working on its own.

Only then, as Ogra said, should you get Qt5 wrking. Note that the run.sh script you’re using is configured for X11. It has support for multiple toolkits that are unnecessary for you here - you only need Qt5 support.

You need to edit it for Qt5 to work with Mir, if you are using mir kiosk.

The important parts to change are:
export QT_QPA_PLATFORM=xcb
here, “xcb” should be changed to “ubuntumirclient”. You’ll need to add qtubuntu-desktop as a dependency to the yaml file too.

Also I recommend removing QT_QPA_PLATFORMTHEME entirely.
-G


#15

When I run sudo systemctl start snap.mir-kiosk.mir-kiosk.service I see black screen and mouse cursor, nothing more.


#16

perfect … that is what you want … now you can start working on your app and make it run on top of this, just follow greybacks advise and add the necessary bits to your scripts and snapcraft.yaml


#17

I’m very sorry, I did not show the correct script. It was old.
This one is now the one I’m collecting.


#18

I assume that I’m missing something in the settings of this script, since I see only such a conclusion and that’s all.

declare -x SNAP_NAME=“bsp095project"
declare -x SNAP_REEXEC=”“
declare -x SNAP_REVISION=“x1"
declare -x SNAP_USER_COMMON=”/home/sektorct/snap/bsp095project/common"
declare -x SNAP_USER_DATA=”/home/sektorct/snap/bsp095project/x1"
declare -x SNAP_VERSION="1.0"
declare -x SSH_CLIENT=“172.17.250.135 46820 22"
declare -x SSH_CONNECTION=“172.17.250.135 46820 172.17.250.246 22"
declare -x SSH_TTY=”/dev/pts/0"
declare -x TEMPDIR=”/tmp"
declare -x TERM=“xterm-256color"
declare -x TMPDIR=”/tmp"
declare -x USER=“sektorct”


#19

Tell me please, what is missing in this last script for launching the application?
It now has what it takes to work with the Mir.
And if I understand you correctly, in snapcraft something is not enough, for correctly work?
Thx.


#20

I don’t understand what you are asking me. I don’t know what is “missing” in the script. I don’t have enough information to help you.

In order for me to help, you need to clearly explain what you want, what you are doing, what is going wrong, and share any log files that might give us a clue.

Yes, in the snapcraft yaml file, you need to add “qtubuntu-desktop” as another “stage-package”, as that contains the ubuntumirclient QPA plugin.