Qt: Add support for ubuntu touch

Created on 14 Feb 2018  路  19Comments  路  Source: therecipe/qt

Building for ubuntu touch can be done easily with a docker container :)

Most helpful comment

It would be great to integrate this with clickable (command line tool for compiling Ubuntu Touch apps), let me know if I can help! http://clickable.bhdouglass.com/en/latest/

All 19 comments

Building for Sailfish with docker would be a big deal as well. :b

PS: I thought ubuntu touch is expired?

Ubuntu touch is like a phoenix it's now in community hands and it is a quite active https://ubports.com/

馃憤 for Support Ubuntu Touch
I have ubports Ubuntu touch 15.04 on nexus 5

It would be great to integrate this with clickable (command line tool for compiling Ubuntu Touch apps), let me know if I can help! http://clickable.bhdouglass.com/en/latest/

Ubuntu touch uses qt 5.4.1, today i tried to compile the demo in getting started with that and I get the following error. What is the oldest supported version of qt?

@nanu-c
The oldest supported version is Qt 5.6.0 atm, but I will look into this.
I initially planned to support ubuntu touch when I worked on the sailfish support, but there where signs that it might get dropped in the future. (Also there was some other thing called plasma mobile, don't know if this was/is related)

@Frzifus
I looked into this as well, but couldn't get the mersdk running nor get virtual box on docker.
I also recall trying to dump the sdk vdi to work around this, but didn't succeed.
But I will try to look into this as well.

The Ubuntu Touch Community is working to port everything to Ubuntu 16.04 and I think the supported version there is 5.9.... so we have to wait. Somewhere I they said maybe it could be stable in 3 months...

@nanu-c
I looked into this, and there were fewer changes than expected needed to get it working with Qt 5.4.x.
You can now find the 4 images for the ubports sdk here: https://github.com/therecipe/qt/tree/master/internal/docker

However, it's still not integrated into qtdeploy and I haven't had time to actually test the created binaries, but they should probably work. To test this, simply build one of the docker images and then use qtdeploy build linux inside on one of the examples.
(A lot of errors will probably show up about missing packages during "docker build" but you can ignore these.)

@bhdouglass
First, thanks for the docker images.
Second, what is the best minimal "clickable.json" I could use for this? And what else do I need?
Probably a manifest and the *.desktop file, but do I need the *.apparmor file as well?

You should be able to work with a clickable.json like this:

{
  "template": "go"
}

And yeah you'll need the apparmor file to make an ubuntu touch app.

For the command go/src/github.com/therecipe/qt/internal/docker/ubports_arm_vivid$ docker build -t therecipe/qt:linux . I get the following result

time="2018-03-28T06:56:02Z" level=info msg="installing full qt/webview"
time="2018-03-28T06:56:03Z" level=warning msg="failed to install:"
time="2018-03-28T06:56:03Z" level=warning msg=core
time="2018-03-28T06:56:03Z" level=warning msg=gui
time="2018-03-28T06:56:03Z" level=warning msg=network
time="2018-03-28T06:56:03Z" level=warning msg=xml
time="2018-03-28T06:56:03Z" level=warning msg=dbus
time="2018-03-28T06:56:03Z" level=warning msg=script
time="2018-03-28T06:56:03Z" level=warning msg=sensors
time="2018-03-28T06:56:03Z" level=warning msg=positioning
time="2018-03-28T06:56:03Z" level=warning msg=widgets
time="2018-03-28T06:56:03Z" level=warning msg=sql
time="2018-03-28T06:56:03Z" level=warning msg=qml
time="2018-03-28T06:56:03Z" level=warning msg=websockets
time="2018-03-28T06:56:03Z" level=warning msg=xmlpatterns
time="2018-03-28T06:56:03Z" level=warning msg=svg
time="2018-03-28T06:56:03Z" level=warning msg=multimedia
time="2018-03-28T06:56:03Z" level=warning msg=quick
time="2018-03-28T06:56:03Z" level=warning msg=help
time="2018-03-28T06:56:03Z" level=warning msg=location
time="2018-03-28T06:56:03Z" level=warning msg=scripttools
time="2018-03-28T06:56:03Z" level=warning msg=uitools
time="2018-03-28T06:56:03Z" level=warning msg=testlib
time="2018-03-28T06:56:03Z" level=warning msg=serialport
time="2018-03-28T06:56:03Z" level=warning msg=printsupport
time="2018-03-28T06:56:03Z" level=warning msg=designer
time="2018-03-28T06:56:03Z" level=warning msg=sailfish

And I think the most important errors are

time="2018-03-28T06:51:07Z" level=info msg="generating full qt/core"
time="2018-03-28T06:51:12Z" level=error msg="failed to run command" cmd="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake -o Mfile /home/user/work/src/github.com/therecipe/qt/core.pro -spec linux-g++ CONFIG+=release" env= error="fork/exec /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake: no such file or directory" func=RunCmdOptional name="run qmake for linux on linux"

core.cpp:9:30: fatal error: QAbstractAnimation: No such file or directory

@nanu-c

Maybe try to pull one of the prebuilt "therecipe/qt:ubports_arm_vivid" images now.
If you update the binding, you should also be able to compile an application with:

qtdeploy -docker build ubports_arm_vivid path/to/project

alternatively run something like:

docker run --rm -v $GOPATH:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -i therecipe/qt:ubports_arm_vivid qtdeploy -debug build ubports /media/sf_GOPATH0/src/github.com/therecipe/qt/internal/examples/ubports/view

Another way to directly test one of the images would be to run

docker run --rm -it therecipe/qt:ubports_arm_vivid

and then inside the container

cd $GOPATH/src/github.com/therecipe/qt/internal/examples/ubports/view && qtdeploy build ubports`

(if you want to get the created "*.click" package out of the container then you will need to share some folder first with -v or maybe use the first or second command)

@bhdouglass

Thanks, I figured that "clickable" works similar to "qtdeploy" by making use of docker to compile your application. So I resorted to run "click" directly inside the containers.

If you still want to integrate this with clickable, then take a look at the second command I posted above. If commands similar to this one are called by clickable, then there is no need to install Go on the host, and the whole compilation + deployment process should happened inside the container.
The manifest, app armor, desktop file (and any other file) can be placed inside a folder called "ubports" inside the root folder of the project and are then bundled later automatically.

@Frzifus

It was a pain, but once the images are done: https://hub.docker.com/r/therecipe/qt/builds/
You should be able to run
docker pull therecipe/qt:sailfish
and then
qtdeploy -docker build sailfish path/to/project
or
qtdeploy -docker build sailfish-emulator path/to/project

or for one of the ubports images:
docker pull therecipe/qt:ubports_64_xenial
and then
qtdeploy -docker build ubports_64_xenial path/to/project

Also the normal sailfish support by leveraging the sdk + virtualbox, should work again as well.
But I might need to update the wiki with an instruction how to set this up.

The result for

docker run --rm -v $GOPATH:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -i therecipe/qt:ubports_arm_vivid qtdeploy -debug build ubports /media/sf_GOPATH0/src/github.com/therecipe/qt/internal/examples/ubports/view

is here
https://gist.github.com/nanu-c/726de48364864eee30935fab67b59015
One intresting line is this

env= error="fork/exec /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake: no such file or directory"
qtexample$ qtdeploy -docker build ubports_arm_vivid ./
FATA[0000] ubports_arm_vivid is currently not supported 

Inside the container I have this log:

error="fork/exec /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake: no such file or directory" 

https://gist.github.com/nanu-c/58cd110b9fe3ff3b1d0d9f08b5d9ecbe

@nanu-c
Sorry, yeah there is some issue with the ubports_arm_vivid image.
Somehow qmake can't read/write to shared folders, I fixed this already and will push the changes later.
The other images should work though.

Also because of the FATA[0000] ubports_arm_vivid is currently not supported issue.
Did you update the binding on the host?

However, this should work even without updating the binding:

docker run --rm -v $GOPATH:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -it therecipe/qt:ubports_arm_vivid
qtdeploy build ubports /home/user/work/src/github.com/therecipe/qt/internal/examples/ubports/view && cp /home/user/work/src/github.com/therecipe/qt/internal/examples/ubports/view/deploy/ubports/*.click /media/sf_GOPATH0

You should find a *.click file in your GOPATH, if everything was run successfully.

@therecipe The download of the container worked perfectly. But it throws me a startup error.
$ qtdeploy -docker build sailfish . ERRO[0000] failed to run command cmd="docker run --rm -e IDUG=1000:100 -v /home/frzifus/git/golang_workspace:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -i therecipe/qt: qtdeploy -debug -ldflags= -tags= build sailfish /media/sf_GOPATH0/src/github.com/frzifus/rpic" env= error="exit status 125" func=RunCmd name="deploy binary for sailfish on linux with docker" docker: invalid reference format. See 'docker run --help'.

Still trying to get it run, thanks for the help until now:

qtdeploy build ubports $GOPATH/src/github.com/therecipe/qt/internal/examples/ubports/view && cp $GOPATH/src/github.com/therecipe/qt/internal/examples/ubports/view/deploy/ubports/*.click $GOPATH
# github.com/therecipe/qt/core
/home/nanu/Qt5.4.1/5.4/gcc_64/lib/libQt5Svg.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

I think this should use the qt version directly installed in the clickable/ubuntu-sdk:15.04-armhf container.

When I try to run inside the container, I still get
env= error="fork/exec /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake: no such file or directory"

root@0ac1d0957538:/media/sf_GOPATH0/src# /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake
bash: /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake: No such file or directory

Finally I got it working by doing this inside the container

rm /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake
ln -s /usr/bin/qt5-qmake-arm-linux-gnueabihf /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake
go get -u -v github.com/therecipe/qt/cmd/...
qtsetup
qtdeploy build ubports github.com/therecipe/qt/internal/examples/ubports/view/

The view example fails on a ubuntu touch device with this error

Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'
SIGILL: illegal instruction
PC=0x5d21e m=0 sigcode=1
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x99470, 0x10851f74, 0x434b00)
    /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0x10851f54 sp=0x10851f3c pc=0x24204
github.com/therecipe/qt/gui._Cfunc_QGuiApplication_NewQGuiApplication(0x1, 0x434b00, 0x0)
    _cgo_gotypes.go:263 +0x38 fp=0x10851f70 sp=0x10851f54 pc=0x92e50
github.com/therecipe/qt/gui.NewQGuiApplication(0x1, 0x1080e0e8, 0x1, 0x1, 0x0)
    /media/sf_GOPATH0/src/github.com/therecipe/qt/gui/gui-minimal.go:548 +0x90 fp=0x10851fa0 sp=0x10851f70 pc=0x93adc
main.main()
    /media/sf_GOPATH0/src/github.com/therecipe/qt/internal/examples/ubports/view/view.go:13 +0x48 fp=0x10851fbc sp=0x10851fa0 pc=0x98b20
runtime.main()
    /usr/local/go/src/runtime/proc.go:198 +0x204 fp=0x10851fe4 sp=0x10851fbc pc=0x4c2e8
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm.s:1015 +0x4 fp=0x10851fe4 sp=0x10851fe4 pc=0x71d0c

trap    0x6
error   0x0
oldmask 0x0
r0      0xffffffff
r1      0xffffff
r2      0xb6fbb4d1
r3      0xb6c9efc8
r4      0x0
r5      0xb6f8dfb8
r6      0x48d398
r7      0xb6ca1ae8
r8      0xb6fc7f10
r9      0x0
r10     0x147888
fp      0xb6ba3018
ip      0xb6ca1bbc
sp      0xbe9e3dcc
lr      0xb6996618
pc      0x5d21e
cpsr    0x200d0030
fault   0x0

@Frzifus
Did you update the binding on your host system before running qtdeploy -docker ...?
However you can also try to run it manually like this:

docker run --rm -e IDUG=1000:100 -v /home/frzifus/git/golang_workspace:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -i therecipe/qt:sailfish qtdeploy -debug -ldflags= -tags= build sailfish /media/sf_GOPATH0/src/github.com/frzifus/rpic

@nanu-c
Ah, yeah sorry it seems like I passed the wrong spec filename to qmake, so ld tried to link against the wrong libs. (And/or maybe there was no rpath set or something)
But https://github.com/therecipe/qt/commit/c38504e5a84f015d256affe7f449b36f2a5bc4e3 should fix this.

I hope this was the cause of the libubuntu_application_api_touch_mirclient.so.3.0.0 issue.
And the other qmake issue should be fixed now as well.

Didn't know about qt5-qmake-arm-linux-gnueabihf, but it seems like it produces the same Makefiles as the old one if the correct spec file is used.

Also do you know if I can still use the old ubuntu touch emulator to test the vivid amd64 builds?

i did upgrading the bindings an tried to build slackfish.
qtdeploy -docker build sailfish . didnt work for me.

docker run --rm -e IDUG=1000:100 -v /home/frzifus/git/golang_workspace:/media/sf_GOPATH0 -e GOPATH=/home/user/work:/media/sf_GOPATH0 -i therecipe/qt:sailfish qtdeploy -debug -ldflags= -tags= build sailfish /media/sf_GOPATH0/src/github.com/neversun/Slackfish worked, though.
So i did compare the build instruction.
If you use qtdeploy, the name of the target is missing. In this case sailfish -i therecipe/qt:sailfish

So far everything works out. But must qt be installed locally? Get this error message:
mime mime/quotedprintable net/http/internal github.com/neversun/Slackfish/vendor/gopkg.in/qml.v1 \# pkg-config --cflags Qt5Core Qt5Widgets Qt5Quick Package Qt5Core was not found in the pkg-config search path. Perhaps you should add the directory containing "Qt5Core.pc" to the PKG_CONFIG_PATH environment variable No package "Qt5Core" found Package Qt5Widgets was not found in the pkg-config search path. Perhaps you should add the directory containing "Qt5Widgets.pc" to the PKG_CONFIG_PATH environment variable No package "Qt5Widgets" found Package Qt5Quick was not found in the pkg-config search path. Perhaps you should add the directory containing "Qt5Quick.pc" to the PKG_CONFIG_PATH environment variable No package "Qt5Quick" found pkg-config: exit status 1 vendor/golang_org/x/net/lex/httplex vendor/golang_org/x/net/proxy net/textproto crypto/x509 mime/multipart crypto/tls net/http/httptrace net/http net/http/httputil github.com/neversun/Slackfish/vendor/github.com/gorilla/websocket github.com/neversun/Slackfish/vendor/github.com/nlopes/slack
then the process ends without further messages.

To build "github.com/therecipe/examples/deploy/sailfish" works perfectly fine!

mh... after manually rebuilding qtdeploy this now also works. strange that it didn't work before.

Will close this now, please create a new issue if this is still relevant

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vahid-sohrabloo picture vahid-sohrabloo  路  7Comments

joeblew99 picture joeblew99  路  7Comments

angiglesias picture angiglesias  路  5Comments

iMaxopoly picture iMaxopoly  路  3Comments

mathieujobin picture mathieujobin  路  4Comments