2

I had an application written in Qt5.12.2, which uses QCharts to plot some signals. I want this application to run in a Zynq based board, specifically in the Zybo board from Xilinx. However, the provided information for Xilinx covers only Qt version 5.4: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842110/Qt+Qwt+Build+Instructions+Qt+5.4.2+Qwt+6.1.2, which, although, compiles correctly do not provide the Qt Charts module I need.

I have tried compiling with the same options as the shown in the Xilinx link, however, several modules couldn't be compiled. To avoid this errors I tried skipping the modules I cannot compile, until I arrive that the Qt Charts cannot be compiled as well.

The last configuration for Qt compilation was:

./configure -xplatform arm-linux-gnueabihf-g++ \
    -opensource \
    -confirm-license \
    -nomake examples \
    -verbose -skip qtpurchasing -skip qtconnectivity -skip qtdeclarative -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtsensors -skip qttools -skip qtwebsockets -skip qtwinextras -skip qtwebchannel -skip qtwebengine \
    -no-gif \
    -no-libjpeg \
    -no-mtdev \
    -no-sql-db2 \
    -no-sql-ibase \
    -no-sql-mysql \
    -no-xcb \
    -qt-freetype \
    -no-fontconfig \
    -no-harfbuzz \
    -no-xcb-xlib \
    -no-cups \
    -no-iconv \
    -no-icu \
    -no-eglfs -no-opengl\
    -no-openssl \
    -prefix $ZYNQ_QT_INSTALL

Where $ZYNQ_QT_INSTALL in this case was set to /usr/local/Qt-5.12.2/.

The last error in compilation was:

arm-linux-gnueabihf-g++ -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -shared -o libqtchartsqml2.so .obj/chartsqml2_plugin.o .obj/declarativechart.o .obj/declarativexypoint.o .obj/declarativexyseries.o .obj/declarativelineseries.o .obj/declarativesplineseries.o .obj/declarativeareaseries.o .obj/declarativescatterseries.o .obj/declarativepieseries.o .obj/declarativebarseries.o .obj/declarativecategoryaxis.o .obj/declarativemargins.o .obj/declarativeaxes.o .obj/declarativepolarchart.o .obj/declarativeboxplotseries.o .obj/declarativechartnode.o .obj/declarativecandlestickseries.o  -L/home/luighi/Qt-crosscompiled/qt5/qtdeclarative/lib -lQt5Quick -L/home/luighi/Qt-crosscompiled/qt5/qtbase/lib -L/home/luighi/Qt-crosscompiled/qt5/qtcharts/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lpthread    
/opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lQt5Quick
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:140: ../../qml/QtCharts/libqtchartsqml2.so] Error 1
make[3]: Leaving directory '/home/luighi/Qt-crosscompiled/qt5/qtcharts/src/chartsqml2'
make[2]: *** [Makefile:91: sub-chartsqml2-make_first-ordered] Error 2
make[2]: Leaving directory '/home/luighi/Qt-crosscompiled/qt5/qtcharts/src'
make[1]: *** [Makefile:49: sub-src-make_first] Error 2
make[1]: Leaving directory '/home/luighi/Qt-crosscompiled/qt5/qtcharts'
make: *** [Makefile:493: module-qtcharts-make_first] Error 2

I don't know how to achieve this version correctly cross compiled. Could you help me to solve this issue, please?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • A part of Qt Charts implements code for QML, so a dependency of Qt Charts must be QtQuick, so I see that you should not skip the qtdeclarative module – eyllanesc Apr 01 '19 at 22:34
  • That's an interesting point. However, when I enable the Qt declarative I had some compilation errors related to `items/qquickclipnode_p.h:57:30: error: comdat-local function called by void QQuickWindowIncubationController::incubate() outside its comdat class Q_QUICK_PRIVATE_EXPORT QQuickDefaultClipNode : public QSGClipNode` This happens in version Qt 5.12, Qt 5.9 and, apparently, also in Qt 5.11 as shown in an opened thread in the Xilinx forum: https://forums.xilinx.com/t5/Embedded-Development-Tools/Internal-Compiler-Error-while-building-qt-5-11-1-manually/td-p/920554 – Luighi Viton-Zorrilla Apr 01 '19 at 23:56
  • I was reviewing the QtCharts repo: https://code.qt.io/cgit/qt/qtcharts.git/, and I see that it should not generate problems. So I recommend you again just compile qtbase: https://code.qt.io/cgit/qt/qtbase.git/ and after doing it just try to compile Qt Charts – eyllanesc Apr 02 '19 at 00:09
  • I followed your suggestion, compiling the qtbase module first, with no errors. However, when I try to compile the QtChart module, I get the same error as when the Qtdeclarative was compiled first: `items/qquickclipnode_p.h:57:30: error: comdat-local function called by void QQuickWindowIncubationController::incubate() outside its comdat class Q_QUICK_PRIVATE_EXPORT QQuickDefaultClipNode : public QSGClipNode`. Apparently, no module which depends on this item can be compiled. – Luighi Viton-Zorrilla Apr 02 '19 at 00:53
  • Okay, I recommend you make a fork of https://github.com/qt/qtcharts/tree select the brach you are using, Then edit the file https://github.com/qt/qtcharts/blob/5.12/src/src.pro removing `qtHaveModule(quick) { SUBDIRS += chartsqml2 }` , and also remove the chartsqml2 directory that might cause problems and you compile the project, I think that Qt Charts will not use QML – eyllanesc Apr 02 '19 at 00:58
  • Thanks, I could compile the QtCharts, making some changes in the generated makefile to skip qtdeclarative dependency. Deleting the chartsqml12 wasn't necessary. Indeed, it is required to complete the compilation without errors. However, now I have another trouble where I can't use the crosscompiled library in my filesystem distribution, apparently, because some version incompatibility between the xilinx toolchain and the installed libraries in the filesystem distribution. – Luighi Viton-Zorrilla Apr 03 '19 at 18:07
  • When you do cross-compiler you have to copy the files to your device (xilinx). Have you done it ?, because if you have not done it, the binaries are only in your HOST. – eyllanesc Apr 03 '19 at 18:11
  • For example, in [this guide](https://wiki.qt.io/RaspberryPi2EGLFS) in step 11 copy the binaries + the headers in the rpi, something similar you should do, I indicate it because in your tutorial I do not see that step. – eyllanesc Apr 03 '19 at 18:15
  • Indeed, I have done that. However, when installed in the target device, it doesn't get the proper version of glibc libraries. I guess that, it is outdated compared to the provided by the xilinx toolchain. I checked it when trying to compile qt libraries against the linaro root filesystem (giving me several errors and, consequently, wasn't successful), which, although, xilinx guide do not consider, I believe its important according to the [linaro guide](https://wiki.linaro.org/WorkingGroups/Middleware/Graphics/Qt/CrossCompiling). Apparently, I need to move on to another filesystem. – Luighi Viton-Zorrilla Apr 03 '19 at 21:04

1 Answers1

0

I would not recommend the way which Xilinx describes in that documentation. The below process would work for any kind of target running Linux.

If you are willing to use Yocto/OpenEmbedded Qt5 support can be included with it and the latest Xilinx release v2018.3 supports Qt 5.9.6 in it's meta-qt5 layer. It's easy to include packages like qtcharts in the Linux image generated by Yocto. A meta-toolchain-qt5 target provides the SDK which can be used with QtCreator to cross compile applications for the intended target.

Sanchayan Maity
  • 637
  • 6
  • 19
  • Interesting! In fact, I followed the workaround pointed out by @eyllanesc, achieving the compilation, sacrificing all the qtquick functionality and related modules. But, at the end when I tried to use in QtCreator, I coudn't compile my application. I guess, it is because the incompatibility between the toolchain provided for Xilinx (I'm using 2018.2), with the libraries in the filesystem (Linaro Ubuntu 12.11). Actually, I wasn't willing about using an outdated distribution, however, that was the latest which came with a preinstalled desktop environment. I never proved Yocto, I will review it! – Luighi Viton-Zorrilla Apr 03 '19 at 18:16
  • @LuighiAnthonyVitónZorrilla Yocto is the best option because it allows you to customize it, which is very light and ideal if you do not want a desktop system – eyllanesc Apr 03 '19 at 18:18
  • @LuighiAnthonyVitónZorrilla I also checked the build of qtcharts. I use a UltraScale MPSoC and qtcharts build fine. I did not build meta-toolchain-qt5 but I hope that should build fine too. – Sanchayan Maity Apr 04 '19 at 02:44
  • @SanchayanMaity i am also trying to cross compile qt , but getting error as OPENGLES not found.. Can you please let me know the procedure for cross compile by using Yocto flow(meta-toolchain-qt5) – Vikas Singh Dec 17 '19 at 07:14