Unsolved Qt Creator cross compilation kit configuration issue (sysroot, libraries)
Xavier last edited by
I'm using Yocto and configures a dedicated kit to the cross compilation environment.
When I tried to compile a "helloworld" program I had a linking issue.
I found a solution but I'm not sure I used the good way to solve my issue and I wonder if somebody in this forum can explain me why I experience such an issue and how to fix it properly.
I did compile qt5 toolchain with yocto (
meta-toolchain-qt5) and install it.
I did update
qtcreator.shto set the env variable required for cross compilation
I configured the debugger to use the
gdbof my toolchain.
I configured the compiler to use the
g++compiler of my toolchain
I configured qmake to use the
qmakeof my toolchain.
I configured a kit using all these programs and specifying my
As I'm cross compiling for a docker image, I kept the device type as
When I tried to compile my "helloworld" program (named QtVersion and writing the version of Qt in a console), the linker is giving me the following error.
g++ -o QtVersion main.o -lQt5Core -lpthread /usr/bin/ld: cannot find -lQt5Core
In this command, few thing are missing for cross compilation.
sysrootis not present, the
libraries directoriesare also missing.
To solve this issue, I did add the following parameters to
qmakecommand executed by my project:
QMAKE_LIBS+="-L/usr/lib -L/lib" QMAKE_LFLAGS+="-Wl,-O1 -Wl,-z,origin -Wl,-rpath,\$$ORIGIN -Wl,-rpath,/usr/lib -Wl,-rpath,/lib --sysroot=/data/Yocto/sdk/krogoth/dockerguest/2.1/sysroots/core2-64-poky-linux"
Now, the compilation and execution are working fine.
Whay should I had to specify such
QMAKE_VARIABLEto make it work?
Shouldn't it be done automatically?
The compilation was working but not the linking, why?
Here is the compilation command:
g++ -c -pipe -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_CORE_LIB -I../QtVersion -I. -isystem /data/Yocto/sdk/krogoth/dockerguest/2.1/sysroots/core2-64-poky-linux/usr/include/qt5 -isystem /data/Yocto/sdk/krogoth/dockerguest/2.1/sysroots/core2-64-poky-linux/usr/include/qt5/QtCore -I. -I/data/Yocto/sdk/krogoth/dockerguest/2.1/sysroots/core2-64-poky-linux/usr/lib/qt5/mkspecs/linux-g++ -o main.o ../QtVersion/main.cpp
I hope you will be able to help me to understand why I experienced such an issue and how to solve it cleanly.
Thx and rgds,