Unsolved Has anyone successfully built Qt from source recently on a Pi?
-
This work for me.
apt-get install \ bison \ build-essential \ flex \ gperf \ libasound2-dev \ libatkmm-1.6-dev \ libbz2-dev \ libcap-dev \ libcups2-dev \ libdrm-dev \ libegl1-mesa-dev \ libfontconfig1-dev \ libfreetype6-dev \ libgcrypt11-dev \ libglu1-mesa-dev \ libgstreamer-plugins-base0.10-dev \ libgstreamer0.10-dev \ libicu-dev \ libnss3-dev \ libpci-dev \ libpulse-dev \ libssl-dev \ libudev-dev \ libx11-dev \ libx11-xcb-dev \ libxcb-composite0 \ libxcb-composite0-dev \ libxcb-cursor-dev \ libxcb-cursor0 \ libxcb-damage0 \ libxcb-damage0-dev \ libxcb-dpms0 \ libxcb-dpms0-dev \ libxcb-dri2-0 \ libxcb-dri2-0-dev \ libxcb-dri3-0 \ libxcb-dri3-dev \ libxcb-ewmh-dev \ libxcb-ewmh2 \ libxcb-glx0 \ libxcb-glx0-dev \ libxcb-icccm4 \ libxcb-icccm4-dev \ libxcb-image0 \ libxcb-image0-dev \ libxcb-keysyms1 \ libxcb-keysyms1-dev \ libxcb-present-dev \ libxcb-present0 \ libxcb-randr0 \ libxcb-randr0-dev \ libxcb-record0 \ libxcb-record0-dev \ libxcb-render-util0 \ libxcb-render-util0-dev \ libxcb-render0 \ libxcb-render0-dev \ libxcb-res0 \ libxcb-res0-dev \ libxcb-screensaver0 \ libxcb-screensaver0-dev \ libxcb-shape0 \ libxcb-shape0-dev \ libxcb-shm0 \ libxcb-shm0-dev \ libxcb-sync-dev \ libxcb-sync-dev \ libxcb-sync1 \ libxcb-util1 \ libxcb-util-dev \ libxcb-xevie0 \ libxcb-xevie0-dev \ libxcb-xf86dri0 \ libxcb-xf86dri0-dev \ libxcb-xfixes0 \ libxcb-xfixes0-dev \ libxcb-xinerama0 \ libxcb-xinerama0-dev \ libxcb-xkb-dev \ libxcb-xkb1 \ libxcb-xprint0 \ libxcb-xprint0-dev \ libxcb-xtest0 \ libxcb-xtest0-dev \ libxcb-xv0 \ libxcb-xv0-dev \ libxcb-xvmc0 \ libxcb-xvmc0-dev \ libxcb1 \ libxcb1-dev \ libxcomposite-dev \ libxcursor-dev \ libxdamage-dev \ libxext-dev \ libxfixes-dev \ libxi-dev \ libxkbcommon-dev \ libxrandr-dev \ libxrender-dev \ libxslt1-dev \ libxss-dev \ libxtst-dev \ perl \ python \ ruby apt-get install \ libpq-dev \ libmysqlclient-dev \ libsqlite3-dev cd /usr/local/src wget https://download.qt.io/official_releases/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz tar -xvzf qt-everywhere-opensource-src-5.8.0.tar.gz cd qt-everywhere-opensource-src-5.8.0 ./configure \ -opensource -confirm-license \ -opengl es2 \ -nomake tools \ -nomake examples \ -nomake tests \ -skip qtwebkit \ -skip qtwebkit-examples # -j{4} number of CPU cores make -j4 make install cd /usr/local
-
Thanks @ambershark
I should have specified that my question was for the case of cross-compiling Qt for an RPi-class embedded device. In particular, I am building on an x86-64 PC running Ubuntu 16.04.2, for an aarch64 Odroid C2 also running Ubuntu 16.04.2. After a lot of rooting around, I have discovered that the problem is the following:One of the places where the "undefined reference" error hits, is for a surprisingly mundane function like QString::resize(), in a link target like libQt5Xml.so:
~/Projects/ARM/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -shared -o libQt5Xml.so.5.8.0 -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -L~/Projects/Odroid/C2/Qt/qt5-build/lib -lQt5Core -lpthread
Objects like qstring.o were bundled like so into libQt5Core.so, preceding the above step:
aarch64-linux-gnu-g++ -shared -o libQt5Core.so.5.8.0 ... .obj/qstring.o ...<many other .o objects here>... -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -lpthread -licui18n -licuuc -licudata -lm -ldl -lrt -lz -lpcre16 -lgthread-2.0 -lglib-2.0
So the make process is building a libQt5Core.so, pulling in required libs (e.g. libicudata.so, libdl.so, librt.so etc) from the target machine from the *lib* directories under sysroot. The newly created libQt5Core.so is located in the qt5-build/lib directory on the host machine.
The problem arises when the linker tries to create a target that requires libQt5Core.so. Repeating part of the libQt5Xml.so build command above, the directories searched for dependencies are:
-L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -L~/Projects/Odroid/C2/Qt/qt5-build/lib -lQt5Core -lpthread
Of these, the ones under sysroot are on the target device and the last one is on the host. The problem is that the target also has (an older) Qt5 installation (5.5.1) on it. /usr/lib/aarch64-linux-gnu on the target has all the libQt5*.so files, including libQt5Core.so. It seems like the linker picks up the first libQt5Core.so it finds, which is the one on the target, not the one that was just built on the host (under qt5-build/lib). That does not have the functions required by the new Qt version, and the link fails.
Removing the older Qt5 on the target
odroid@odroid64:~$ sudo apt-get remove libqt5*
works and the 'make' completes without errors. If only the order of directories in the link step could be reversed (such that the local dir is searched first) then the correct libQt5Core.so could be used.
So ultimately, after this long-winded explanation, the question is, is there a way to force the linker to look in the local directories first? I tried the -R option on 'configure', setting it to the qt5-build/lib directory on the host, but that didn't make a difference.
-
@vikramg Hmm that's a good question. It really shouldn't be behaving like that.
I wonder if you try passing LDFLAGS="-L/qt/lib/dir/you/want/to/use" to your configure and subsequent build. I'm not sure if that would work but it may. You could try that in CFLAGS as well or CXXFLAGS.
It shouldn't use the system libs over your libs specified with -L paths though. I'm not sure why it's doing that.
-
@ambershark Some options suggested here seem promising:
-
export LIBRARY_PATH=/local/qt/lib/dir. Then run configure/make.
-
Save the following as a shell script called aarch64-linux-gnu-g++:
#!/bin/sh exec /real/path/to/aarch64-linux-gnu-g++ -L/local/qt/lib/dir "$@"
Then 'chmod +x' the script and put it first in your PATH.
I will try these as well as the LDFLAGS/CXXFLAGS options the next time I try a build, and update this thread if one of them works.
-
-
I believe I have..
I followed https://wiki.qt.io/Native_Build_of_Qt5_on_a_Raspberry_Pi and downloaded the last version, version 5.9.2. But I did not edit ~/opt/qt5/qtbase/configure script - because there were no QT_CFLAGS_DBUS statments in the downloaded version.
I started with a Raspberry Pi 3 flashed with Jessie Light 2017-07-05.
Then, after a raspian-setup I continued without rebooting with:
sudo apt-get install --no-install-recommends xserver-xorg
sudo apt-get install --no-install-recommends xinit
sudo apt-get install raspberrypi-ui-mods
and the packages needed for compiling according to the article.
I had to install git in addition.Every step ran to completion without any errors and I ran the qube test at the end of the article. It worked in console mode, and after a reboot - also under X11.
But, I did not get the result I wanted. The cube application took the whole screen. It is not a "good" display environment citizen. I want my app to coexist with other applications.
My question is:
What can I do for creating an applicaton that run in the display environment?
Do I have to run the configure script with other parameters or is there another way of achieving my goal?This is the line I have used:
Command line: -v -opengl es2 -device linux-rasp-pi-g+ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5