Skip to content
Advertisement

Yocto/Qt5.6: Unable to build a sample Qt Application

I have a working Nitrogen6x board that runs on Yocto Krogoth-next build with core-image-sato. I have installed Qt Creator 3.5.1 (based on Qt 5.5.1) and I have added my kit for nitrogen6x board as per [Build & Install Qt5 toolchain] document. I have added a sample Qt Quick Application with component set chosen as Qt Quick 2.1 and tried to compile the source, I am noticing this below error.

19:04:25: Running steps for project untitled6...
19:04:25: Starting: "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" /home/test/untitled6/untitled6.pro -r -spec linux-g++
19:04:25: The process "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" exited normally.
19:04:25: Starting: "/usr/bin/make" 
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o main.o ../untitled6/main.cpp
/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/rcc -name qml ../untitled6/qml.qrc -o qrc_qml.cpp
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o qrc_qml.o qrc_qml.cpp
g++ -Wl,-O1 -o untitled6 main.o qrc_qml.o   -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread 
/usr/bin/ld: cannot find -lQt5Quick
/usr/bin/ld: cannot find -lQt5Gui
/usr/bin/ld: cannot find -lQt5Qml
/usr/bin/ld: cannot find -lQt5Network
/usr/bin/ld: cannot find -lQt5Core
/usr/bin/ld: cannot find -lGLESv2
collect2: ld returned 1 exit status
make: *** [untitled6] Error 1
19:04:26: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled6 (kit: Nitrogen)
When executing step 'Make'
19:04:26: Elapsed time: 00:01.

All the Qt libraries are present under /sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/ and I have set the sysroot path correctly under my kit, but I am unable to figure out why is that my application is failing to reference those libraries. Any help on this is deeply appreciated. Thanks in advance.

Advertisement

Answer

The mkspec pointed to by your kit seem to be the wrong one (linux-g++), quoting from your build log

-I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++

When building for a nitrogen6x, it should likely be linux-oe-g++ instead. This is either set by default in the Qt version you selected, or can be set by modifying the Kit itself, in QtCreator’s options, under “mkspec”.

The error your’s seeing is probably due to the fact the that the ABI & architecture of the libraries pointed are not compatible with the x86/64 code you compiled.

Also make sure to source Yocto’s environment file before starting QtCreator if you encounter problems (namely compile error about “C” not found). This will setup the path to the cross-compiler. Example:

source /opt/poky/1.6.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
~/Qt/Tools/QtCreator/bin/qtcreator
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement