User avatar
mline
Posts: 1134
Joined: Sun Jan 27, 2013 1:47 pm
Location: Austria, Vienna

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Wed Mar 28, 2018 11:11 am

Volodymyr wrote:
Tue Mar 27, 2018 6:27 pm
[email protected]:/opt/qt5pi$ sysroot-relativelinks.py sysroot
bash: /usr/bin/python: No such file or directory
In section "Prepare Linux host", point "Install dependencies" you have to install python
<~~>

DJMOC
Posts: 2
Joined: Sun Apr 01, 2018 1:54 am

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Sun Apr 01, 2018 2:13 am

Hi everyone,

I followed every instructions given and I was able to successfully build the cross-compilation files (at least no error displayed), but In Qt creator every time I try to build for my Pi I have this error : raspi/sysroot/usr/lib/arm-linux-gnueabihf/libicui18n.so.57 : undefined reference to « [email protected]_1.3.8 »

I tried Internet and rebuilt many times from instructions here and from https://wiki.qt.io/RaspberryPi2EGLFS#Step_by_step but I did not found how to fix this.

Raspberry Pi Zero W
PC is Ubuntu 16.04 LTS
Qt 5.10.0

Any help would be apreciated
DJ MOC

DJMOC
Posts: 2
Joined: Sun Apr 01, 2018 1:54 am

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Wed Apr 04, 2018 1:09 am

Hi everyone,

I finaly got it working. I had to rebuild Qt with

Code: Select all

-no-icu
in the config command. I also have to add

Code: Select all

target.path = /home/pi
INSTALLS += target
at the end of the *.pro file for each projects.

I don't exacly understand what ICU does but it's working for me.
Great tutorial by the way, it was the first time I successfully cross-compiled Qt.

DJ MOC

Casp
Posts: 2
Joined: Fri Apr 06, 2018 2:02 am

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Tue Apr 10, 2018 9:23 am

Hi I tried to follow this guide and had some problems:

1. In the guide it would be really helpful to have what goes before the $ too just to make sure you're in the right directory and some numbers on steps so people can refer to them.

2. sysroot-relativelinks.py sysroot
I get a "command not found" error on this and I have followed every step including the sudo apt-get install python step which says it's up to date. Does it need version 3 not version 2.7 that is the default? I don't know how that all works so in the end I just typed "python3 sysroot-relativelinks.py sysroot" and the script appeared to run.

3. When I run the "make" I get a bunch of errors that say "unknown CPU architecture". I'm on the latest RaspberryPI 3B+ so I'm not sure if that's the problem? If that is the problem, is there any kind of ./configure setting for -device that is compatible with the 3B+? Where do you find this kind of stuff. For now this error is a deal breaker because it's not making. So any help would be great.

The one thing I did differently from the guide was to do the SSH step first and then do all the Pi steps that way because I could just be on the one machine, with the guide open.

Host Setup: MacBookPro with OSX 10.13 with VirtualBox running Ubuntu 16.04
RaspberryPi: 3 B+ with the latest Raspian Stretch.

jars121
Posts: 123
Joined: Tue Jun 25, 2013 8:35 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Sun Apr 15, 2018 9:16 am

My setup has been running very nicely since my original posts back in February, but I've now run into a problem.

I've wiped my machine and installed Windows (not by choice believe me), with a virtual Ubuntu 16.04 instance (using Oracle VirtualBox) for Qt development. I've spent the better part of 2 days trying to get this cross-compilation workflow up and running again, and I can't seem to figure out where these errors are coming from. I've been through all the required steps, without error, including configuring Qt Creator with the required debugger, compilers, qt version and kit.

However, when trying to build and run an application (which was working prior to wiping the previous install) on the remote device, I get the following error:

Code: Select all

/home/pi/application/Application: error while loading shared libraries: libQt5Charts.so.5: cannot open shared object file: No such file or directory
Does anyone have any idea what's going on here?

jars121
Posts: 123
Joined: Tue Jun 25, 2013 8:35 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Wed Apr 18, 2018 10:11 pm

Never mind, I went through it again and paid much closer attention and have it running again with 5.9.4 :D

Casp
Posts: 2
Joined: Fri Apr 06, 2018 2:02 am

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Wed May 09, 2018 2:37 pm

Ok using this guide I got it finally working.

I just used Qt 5.10.1, on a RaspberryPi 3+, and MacBookPro using VirtualBox with Ubuntu 18.04.

Now the guide above has an error that will stop everything from working.

When specifying the device to build with in the ./configure step it should be:

Code: Select all

-device linux-rasp-pi3-g++
I also had to carry over a setting from the RaspberryPI2eglfs guide for 5.10 that is not mentioned here in the ./configure step:

Code: Select all

-no-use-gold-linker
I don’t know why the OP spelt that one line differently to the other three but changing it worked for me.

Also to note that the .tar is spelt differently for 5.10 and up:

Code: Select all

qt-everywhere-src-5.10.1.tar.xz
They now leave out the “opensource” part.

I’m just thankful to have this running after weeks of trying so many of these different tutorials. Thanks to all the posts above.

User avatar
mline
Posts: 1134
Joined: Sun Jan 27, 2013 1:47 pm
Location: Austria, Vienna

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Wed May 09, 2018 3:12 pm

Casp wrote:
Wed May 09, 2018 2:37 pm
I don’t know why the OP spelt that one line differently to the other three but changing it worked for me.
Because my tutorial is for 5.7.1 and they changed some things in later versions. For up-to-date tutorial, take a look in german forum.
viewtopic.php?f=75&t=204778
<~~>

Donrico
Posts: 1
Joined: Mon May 21, 2018 12:14 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Mon May 21, 2018 1:37 pm

Great tutorial and I got my qt 10.1 together with some font problems but that's ok. Sadly my project compiles currently only with Clang.
So found clang cross compiler for rpi https://github.com/axonmi/clang-cross-compiler-rpi .
As I understand I have to replace my toolchain with that one. I did as the github page suggested and installed that toolchina in my qt5rpi folder and exported path accordingly.

Next step where it's need is when I configure my QtCreator compilers for Kit and that worked also nicely but every build gives me sys/cdefs.h is missing in features.h. Googled it and it seems something related to building in 64bit linux 32bit application. Tried to install s*it load of packages that should resolve that missing part but with no results. Does anybody have and idea what could give me some results?

Xphysics
Posts: 3
Joined: Sat Jun 23, 2018 11:57 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Sun Jun 24, 2018 12:04 am

Hi everyone, I spent a few weeks to compile qt successfully but until now I have no success.

I follow your instructions. In configure options I use the rasp3.

../qt-everywhere-opensource-src-5.7.1/configure -opengl es2 -device linux-rpi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -make libs -v

It gives an error :

Code: Select all


/opt/qt5pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/arm-linux-gnueabihf/bits/os_defines.h:39:22: fatal error: features.h: No such file or directory
 #include <features.h>
                      ^
compilation terminated.
Makefile:198: recipe for target 'atomicfptr.o' failed
make: *** [atomicfptr.o] Error 1
std::atomic for function pointers disabled.
ERROR: detected a std::atomic implementation that fails for function pointers.
Please apply the patch corresponding to your Standard Library vendor, found in
  /opt/qt5pi/qt-everywhere-opensource-src-5.7.1/qtbase/config.tests/common/atomicfptr
  
  
What I miss ? I really spent much time to just compile qt in my host machine. It should not be so hard.

thanks..

User avatar
mline
Posts: 1134
Joined: Sun Jan 27, 2013 1:47 pm
Location: Austria, Vienna

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Sun Jun 24, 2018 3:03 am

Xphysics wrote:
Sun Jun 24, 2018 12:04 am
What I miss ?
Maybe something is wrong with the sysroot folder /opt/qt5pi/sysroot
<~~>

Xphysics
Posts: 3
Joined: Sat Jun 23, 2018 11:57 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Tue Jun 26, 2018 5:35 am

I tried the steps for a few times. But result is same for me.
I found this -> https://forum.qt.io/topic/69740/cross-c ... 4-error/10
same error.

Is there any idea ?

Should I use later version of qt ?

piotr.partyka
Posts: 1
Joined: Tue Jun 26, 2018 2:26 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Tue Jun 26, 2018 2:35 pm

Hi!
First of all thank you very much @jars121 for such a great tutorial. So far it is the best of what I tried, and trust me I tried a lot of them.

Back to the topic ;)
I generated a Makefile with a qmake from

Code: Select all

/opt/qt5pi/sysroot/usr/local/qt5pi/bin/qmake
and my app have compiled without any errors. Then I copied the binary to my Raspberry Pi2 and tried to run it. Unfortunately this is what happened:

Code: Select all

./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./spotify-client)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./spotify-client)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5Gui.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5Qml.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5WebSockets.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5NetworkAuth.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5Network.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5Test.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/qt5pi/lib/libQt5Core.so.5)
./spotify-client: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/qt5pi/lib/libQt5Core.so.5)
Please help me, that's the end of the line with the cross compilation and it keeps me from developing my app.
Thanks!

Xphysics
Posts: 3
Joined: Sat Jun 23, 2018 11:57 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Thu Jun 28, 2018 7:15 am

Hello everyone again,

I tried the qt 5.10 .1 then it was compiled.

I was try some console example , and it works ( simple hello world examples )

after that When I tried to run some simple hello world gui applications it gives

Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).

error !!! I wanted to see the GUI from HDMI. GUI goes to full screen and not what I design.

What can be the problem ?

Configure command is

../qt-everywhere-src-5.10.1/configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtscript -nomake examples -make libs -no-pkg-config -no-use-gold-linker -v 2>&1 | tee configure.log

ı changed the -pkg-config to -no-pkg-config ......

Is there any one see such an issue ??

I follow these steps for solution but does not effect to my environment -> https://forum.qt.io/topic/77387/eglfs-u ... to-100-dpi

User avatar
Bremenpl
Posts: 75
Joined: Thu Feb 02, 2012 9:32 am
Location: Poland
Contact: Website

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Thu Aug 02, 2018 6:19 am

Hello there,
The provided guide allows to run the application with eglfs. Xcb seems to be installed as well but it does not allow to run with it:

Code: Select all

[email protected]:~ $ ./qopenglwidget -platform xcb
QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
composeAndFlush: QOpenGLContext creation failed
composeAndFlush: makeCurrent() failed // <-application closed here
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
I would appreciate all help regarding solving this issue.
http://lprzenioslo.zut.edu.pl

Ojanguren
Posts: 1
Joined: Sun Sep 09, 2018 2:35 pm

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Sun Sep 09, 2018 2:41 pm

Hi everbody.

First of all, thanks for the guide. Anyway, I'm having trouble with a line of code and I can't guess where I'm making a mistake. So here is the code line I'm struggling with:

Code: Select all

../qt-everywhere-opensource-src-5.7.1/configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -make libs -v
The output says:

Code: Select all

+ cd qtbase
+ /home/ojanguren/qt-everywhere-opensource-src-5.7.1/qtbase/configure -top-level -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -make libs -v
You don't seem to have 'make' or 'gmake' in your PATH.
Cannot proceed.
Does anyone have a suggestion? I'm pretty new to Linux and raspberry pi so sorry if the answer is obvious :) .

User avatar
topguy
Posts: 4914
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Tue Oct 02, 2018 4:29 pm

What version of Linux are you running this on ?

ggarg118
Posts: 15
Joined: Thu May 31, 2018 8:04 am

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Mon Oct 29, 2018 8:15 am

Thanks for this awesome stuff. I compiled the same way and it really work for executable project, but i am looking to build Static libraries instead of Applications which unfortunately not allowing. It is compiling perfectly but i can't run it on my pi. I know this thread is pretty old now but if anyone knows how to do it?

Return to “Graphics programming”