cross compiling for ubuntu 21.10 on raspberry pi 4
-
I've been trying for days to compile Qt 5.15.2 for raspberry pi 4 running ubuntu 21.10 (host PC running ubuntu 20.04) with no luck.
Every guide I've found targets raspbian, not ubuntu and I'm getting lots of 'libs not found' or 'invalid file format'Have anyone tried this?
My command line looks like this
../qt-everywhere-src-5.15.2/configure -release
-opengl es2
-eglfs
-device linux-rasp-pi4-v3d-g++
-device-option CROSS_COMPILE=/home/soren/piqt/rpi-gcc-8.3.0/bin/arm-linux-gnueabihf-
-sysroot /home/soren/piqt/sysroot
-prefix /usr/local/RaspberryQt
-L/home/soren/piqt/sysroot/usr/lib
-I/home/soren/piqt/sysroot/usr/include
QMAKE_LIBS_OPENGL_ES2+="-Wl,-rpath,/home/soren/piqt/sysroot/usr/lib/"
QMAKE_LIBS_EGL+="-Wl,-rpath,/home/soren/piqt/sysroot/usr/lib/"
-opensource
-confirm-license
-skip qtscript
-skip qtwayland
-skip qtwebengine
-skip qtlocation
-skip qtmultimedia
-skip qt3d
-skip qtgamepad
-skip qtconnectivity
-skip qtsensors
-skip qtquick3d
-skip serialport
-nomake tests
-nomake examples
-no-flite
-no-flite-alsa
-no-speechd
-no-dbus
-no-libudev
-no-zlib
-no-zstd
-no-icu
-no-doubleconversion
-no-freetype
-no-harfbuzz
-no-d3d12
-no-use-gold-linker
-no-sqlite
-make libs
-pkg-config
-v
-recheckHelp
-
Hi and welcome to devnet,
Does your sysroot contain all the development packages required to build Qt ?
Usually, invalid file format means that some of the files used are for a different architecture.
-
Hi,
My "top" level looks like thisdrwxrwxr-x 7 soren users 4096 apr 11 00:10 ./
drwxr-xr-x 126 soren users 36864 apr 11 00:26 ../
drwxrwxr-x 20 soren users 4096 apr 11 00:10 build/
drwxrwxr-x 2 soren users 4096 apr 9 14:39 qtbase/
drwxr-xr-x 46 soren users 4096 nov 12 2020 qt-everywhere-src-5.15.2/
drwxr-xr-x 8 soren users 4096 sep 4 2019 rpi-gcc-8.3.0/
drwxrwxr-x 4 soren users 4096 apr 9 08:31 sysroot/
-rwxrwxr-x 1 soren users 959 apr 9 08:01 sysroot-relativelinks.py*and sysroot
drwxrwxr-x 4 soren users 4096 apr 9 08:31 ./
drwxrwxr-x 7 soren users 4096 apr 11 00:10 ../
drwxrwxr-x 2 soren users 4096 apr 9 08:12 opt/
drwxrwxr-x 4 soren users 4096 apr 9 08:32 usr/"opt" is empty on a clean ubuntu and usr have the complete lib and include tree from the target, which is up to date and have the dev packages installed, but maybe I'm missing something.
I changed the QMAKE_LIBS_OPENGL_ES2 and QMAKE_LIBS_EGL to /home/soren/piqt/sysroot/usr/lib/aarch64-linux-gnu/ (because that's where those libs are) and ld still says it can't find them.
/home/soren/piqt/rpi-gcc-8.3.0/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lGLESv2
/home/soren/piqt/rpi-gcc-8.3.0/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lEGL
collect2: error: ld returned 1 exit status
make: *** [Makefile:67: opengl_es2] Error 1
=> source failed verification.
test config.qtbase_gui.libraries.opengl_es2 FAILEDAt least it stopped saying invalid file format :-)
-
Usually the sysroot is a copy of the target root filesystem or a live mount through sshfs or nfs.
-
-
@kingfranz said in cross compiling for ubuntu 21.10 on raspberry pi 4:
/usr/lib, /usr/include and /opt
Yes, you do not have to copy whole root file system.
"I haven't found any info of what is needed" - what is needed heavilly depends on what parts of Qt you want to build. What you can do is: run configure with your current sysroot, see which tests fail and for those you need check why they fail (check configure.log file) and install missing dev packages.