Building Qt applications for i.MX6QP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Building Qt applications for i.MX6QP

Jump to solution
6,552 Views
cagriuslu
Contributor I

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.

Tags (3)
1 Solution
2,736 Views
cagriuslu
Contributor I

I did find a solution.

In addition to the stuff I said above, I wrote a custom mkspec. I put it in /opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs, set "Qt mkspec" option in build kit to linux-arm-poky-gnueabi-g++. Once a new mkspec is specified, modification to the qtcreator.sh became redundant.

I am attaching my custom mkspec. You can use it at your own risk.

View solution in original post

3 Replies
2,733 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Cagri Uslu

I was wondering if you had any progress.

Since there is very little information regarding Qt on the documentation it is always a bit tricky to configure new releases and there is no much support for it. The thread suggestions sometimes are correct but changes in new Qt or even Qt creator releases may change the situation.

I haven’t been able to find a fix for this but if you do please share your findings. Hopefully another user on the communities may help.

Regards,

0 Kudos
2,737 Views
cagriuslu
Contributor I

I did find a solution.

In addition to the stuff I said above, I wrote a custom mkspec. I put it in /opt/fsl-imx-x11/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs, set "Qt mkspec" option in build kit to linux-arm-poky-gnueabi-g++. Once a new mkspec is specified, modification to the qtcreator.sh became redundant.

I am attaching my custom mkspec. You can use it at your own risk.

2,734 Views
donam
Contributor I

I did follow your guide, but i didn't workh1.pngh2.pngh3.pngh4.pngh5.pngh6.pngh7.png@@

0 Kudos