Hi, I am asking this question because the tutorials I found in this forum have NOT worked for me. I have tried the following guides and q&a's.
Building a Qt applications for i.MX6Q
Setup QT Creator with Yocto Build
Setting up Qt Creator to build for i.MX6//
I am trying to build Qt applications on my host machine (Ubuntu) for i.MX6QP Sabre Board. I want to use the toolchain built by Yocto. Let me tell you what I did so far, and where have I stuck.
Setup the Yocto build enviroment:
DISTRO=fsl-imx-x11 MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-x11
Build Qt toolchain:
bitbake meta-toolchain-qt5
Run the setup script:
./tmp/deploy/sdk/fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.0.1.sh
I left the path as default (which was /opt/fsl-imx-x11).
I installed qtcreator-4.2.1 in my home folder, then added the following line to ~/qtcreator-4.2.1/bin/qtcreator.sh as such:
source /opt/fsl-imx-x11/4.1.15-2.0.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
#! /bin/sh
......
......
Then, I run the QtCreator using the same script:
~/qtcreator-4.2.1/bin/qtcreator.sh
I added two compilers manually (C and C++). Their paths were:
/opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
/opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
No problem so far.
I added a new Qt Version by specifying the qmake executable. Its path was:
/opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
qmake is recognized successfully. In its details, QT_SYSROOT is set to /opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi which is good. However, QMAKE_SPEC is set to linux-g++, which seems not right. I can not change anything in here so I'm continuing.
I created a new Kit, choose the sysroot as /opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi, choose the newly created compilers, and that is it. According to the tutorials given above, this should be enough to cross-compile Qt applications for imx6qp.
I created an example QWidgets project using the new Kit. I immediately saw two issues in qtcreator:
"/usr/bin/gcc" is used by qmake, but "/opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc" is configured in the kit.
Please update your kit or choose a mkspec for qmake that matches your target environment better.
"/usr/bin/g++" is used by qmake, but "/opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++" is configured in the kit.
Please update your kit or choose a mkspec for qmake that matches your target environment better.
When I try to build the project, by looking at the compiler output, I saw that qmake uses g++ as compiler, not arm-poky-linux-gnueabi-g++. It couldn't compile the project, and even it could, the binary wouldn't run on i.MX6.
What am I missing here? I have added the source /opt/fsl-imx-x11/4.1.15-2.0.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi directive in the startup script, and I have specified the correct qmake, but it still tires to use my host machine's compilers.