I am trying to cross compile the latest Qt (version 5.9) for the raspberry pi compute module. I am quite new to this but found this guide very helpful: https://visualgdb.com/tutorials/raspberry/qt/embedded/
I followed the instruction but when it comes to configuring qt, I have the following command as suggested in the guide (I have replaced version 5.5 with 5.9):
../qt-everywhere-opensource-src-5.9.0/configure -platform win32-g++ -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-rasp-pi2-g++ -sysroot C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5
In my case this throws the error that I cannot specify both the xplatform and device parameters. I am new to this and I am not sure which one of the two should be specified!
When you select mkspec for configure you can select a host platform with -platform, or when cross-compiling you can select target platform with -xplatform. When cross-compiling for a specific supported device you select the mkspec with -device. You can give options for the specific device with -device-option flag. When using -device flag you don't use -xplatform flag.
In Qt, there seems to be a device mkspec for Raspberry Pi 2. You can find Qt mkspecs from qtbase module in Qt source tree, e.g. Raspberry Pi 2 mkspec: qt-everywhere-opensource-src-5.9.0/qtbase/mkspecs/devices/linux-rasp-pi2-g++.
There is Raspberry Pi Beginners Guide in Qt wiki which might be helpful. It says you should initially build qtbase and then compile other modules one by one. In the wiki there is an example configure command for Raspberry Pi 2 (in Linux host env) which uses -device and -device-option flags:
./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
make -j 4
sudo make install
Related
I am fairly very new to Ubuntu/Linux and am currently running into an issue with getting an ERROR: Unknown command not found. I am trying configure Qt for cross compilation for a raspberry pi. I have looked up for similar issues but to no avail unfortunately.
The code I am running is as follows
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -qpa eglfs -no-xcb -system-freetype -skip qtwebengine -nomake examples -nomake tools -fontconfig
I need to skip a few things in it but when I run this I get this line
ERROR: Unknown command line option '-skip'.
For some extra info, this is my location when doing so as follows when typing in pwd
/home/usr/raspi/qt-everywhere-src-5.11.3/qtbase
Configure is not recognizing the skip option, because you are running it from qtbase folder. Try to tun configure from the top qt folder.
I'm trying to compile a QT from the source code under Windows using the script from the official instructions. (https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW)
cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir `
-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl -opensource -confirm-license `
-make libs -nomake tools -nomake examples -nomake tests"
mingw32-make -k -j4
mingw32-make -k install
In the result I got two problems:
1) build options:
OpenGL:
ANGLE ................................ no
Desktop OpenGL ....................... no
Dynamic OpenGL ....................... no
OpenGL ES 2.0 ........................ yes
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. no
2) fatal error: GLES2/gl2.h: No such file or directory
I tried to set all possible options for the "-opengl" parameter, none worked.
I have installed the directive which is required for ANGLE and the paths in PATH are written, but the installation still does not find it. Also, in the source directory, next to each file that requires GLES2, there are all necessary headers.
I tried to manually download the ANGLE library and write a path to it in PATH, but this did not work.
The same problems were describe in
http://www.qtcentre.org/threads/53752-Error-compiling-qt5-01-on-indovs
https://bugreports.qt.io/browse/QTBUG-59996
but the solutions did not help me.
Search for missing files in the qt folder, copy their parent folders such as GLES2 or KHR to MinGW\x86_64-w64-mingw32\include. It's just brutal force.
I'm following QT's documentation here to the letter: https://wiki.qt.io/RaspberryPi2EGLFS but I am constantly running into the same issue on my mac on Step 10.
I am running the following command:
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v
I get the following error:
Project ERROR: Cannot run compiler '/home/jordan/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++'. Maybe you forgot to setup the environment?
I have been fighting this tooth and nail and I cannot find an answer online, so I'm someone here may have an answer.
The cross-compilation toolchain Raspberry Pi provides is probably built for Linux host systems. You need to use a toolchain built for macOS hosts, such as this one here.
I am new in Qt and Yocto. I used Poky toolchain to cross-compile Qt5 on Ubuntu 12.04.LTS.
I installed and configure Qt5 following these instructions for Building Qt5 using yocto on Wandboard.
/configure v -dont-process -opensource -confirm-license -device imx6 -device-option CROSS_COMPILE=/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi -sysroot /fsl-community-bsp/buildcoreimage/tmp/sysroots/imx6qsabreauto -prefix ~/qt5arm -platform linux-g++ -shared -no-pch -no-rpath -pkg-config -no-accessibility -no-dbus -no-icu -no-directfb -evdev -no-fontconfig -no-opengl -opengl es2 -eglfs -no-glib -no-gtkstyle -no-iconv -system-libjpeg -no-kms -system-libpng -no-linuxfb -no-mitshm -no-nis -openssl -qt-pcre -release -no-sm -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -nomake tests -tslib -libudev -widgets -no-xcb -no-xcursor -no-xfixes -no-xinerama -no-xinput -no-xinput2 -no-xkb -no-xrandr -no-xrender -no-xshape -no-xsync -no-xvideo -system-zlib
When i tried to build my project with qmake I got the following error:
hmi_ph2$ /home/abc/qt5arm/bin/qmake
Project ERROR: Unknown module(s) in QT: webkitwidgets webkit
so I did
sudo apt-get upgrade libqt5webkit5-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
in my .pro file:
QT += qml quick xml network widgets webkit webkitwidgets xmlpatterns multimedia multimediawidgets
You just need to link against webkit, not webkitwidgets : http://qt-project.org/doc/qt-5/qtwebkitwidgets-index.html
So in your case you have to remove webkitwidgets from the line QT += ....
EDIT : As pointed out by Laszlo Papp, the problem is not there. After looking at the configure option for Qt (from the 4.8 doc : http://qt-project.org/doc/qt-4.8/configure-options.html), there is a -webkit option. I do not know if this option still exist for Qt5 as I couldn't find the full option list in Qt5 Doc (http://qt-project.org/doc/qt-5/configure-options.html), but if you try configure -help you 'll see if it exist. If that is the case then it might be your missing piece.
I'm trying to cross compile Qt 5.0.1 (latest release at the moment) for my Raspberry Pi. My set up is as follows:
Operating System: Ubuntu 12.04 32-bit
Cross compiler: Built from crosstool-NG program, using the exact instructions found here
Raspberry Pi Operating System: Raspbian Wheezy 2013-02-09 (mounted at /mnt/raspberry-pi-rootfs)
Configure command:
./configure -no-pch -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/<myusername>/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- -sysroot /mnt/raspberry-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5-raspberry-pi -v
When I run the configure command, it always fails with the following error:
Could not determine the target architecture!
/mnt/raspberry-pi-rootfs/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
Anyone know what this means?
I have tried the latest pre-built Linaro Toolchain cross compiler from here, and Qt at least builds, but any program compiled with it causes SIGILL (illegal instruction) fault as soon as the program runs up, which I guess is because the pre-built cross compler I used is not targeting the right architecture.
Note:
I am aware cross compiling is fiendishly difficult, but I'd like to understand more about what is going on
I'm not sure what the exact cause of this message was, but I managed to sort out by using a pre-buils toolchain for the Raspberry Pi from here:
https://github.com/raspberrypi/tools