Qt 5.12 cross build for armhf on Debian9


Why Qt5 on the arm-linux device

I realized that QJsonDocument performance is quite good compared to boost::property_tree::ptree and it was even better than nlohmann c++ parser for paring QtPlatz's delay/pulse generator time event data (HV values, timing list etc. that is about 3k characters length).  A key issue is whether it can be compiled for armhf based Debian in order to cross-compile for de0-nano-soc.  Just a quick trial for cross-compiling Qt core library;

Install dependencies

sudo apt install libclang-3.8-dev bison flex gperf 
sudo apt install mesa-common-dev:armhf libglu1-mesa-dev:armhf freeglut3-dev:armhf


Cross-tools preparation

First, we should prepare appropriate qmake.conf under /opt/Qt/5.12.0/Src/qtbase/mkspecs/linux-arm-gnueabihf-g++ as:


$ mkdir /opt/Qt/${QTVER}/Src/qtbase/mkspecs/linux-arm-gnueabihf-g++ 
$ cp -r /opt/Qt/${QTVER}/Src/qtbase/mkspecs/linux-arm-gnueabi-g++/* /opt/Qt/${QTVER}/Src/qtbase/mkspecs/linux-arm-gnueabihf-g++ 
$ sed -i -e 's/arm-linux-gnueabi-/arm-linux-gnueabihf-/g' /opt/Qt/${QTVER}/Src/qtbase/mkspecs/linux-arm-gnueabihf-g++/qmake.conf


Configure & Build


$ /opt/Qt/$QTVER/Src/configure -nomake examples -nomake tests -skip qtandroidextras -release -xplatform linux-arm-gnueabihf-g++ -prefix /usr/local/arm-linux-gnueabihf/opt/Qt/$QTVER/ -opensource -confirm-license 


$ make -j8 module-qtbase module-qtlocation 
$ make -j8 module-qtbase module-qtlocation install

User login