2016-11-04 125 views
3

我已经使用Yocto构建了一个Qt工具链。我安装了它并设置了运行由Yocto生成的脚本的环境变量。如何在QtCreator上配置交叉编译工具链?

我打开QtCreator并按照这些instructions打开configure my cross-compiler kit。 我无法建立这样的:

#include <QApplication> 
#include <QPushButton> 


int main(int argc, char **argv) 
{  
    QApplication a(argc, argv);  
    QPushButton hello("Hello world!", 0); 
    hello.resize(100, 30); 
    hello.show();  
    return a.exec();  
} 

收到此错误:

(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag' 

所以我尝试建立这个代替:

#include <stdio.h> 

int main() 
{ 
    printf("Hello world!\n"); 
    return 0; 
} 

这没关系。但是,当我部署到我的目标并尝试运行时,它不能,因为它尚未针对目标架构(arm)进行编译。

helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ldd 

也有这个警告可能是非常指示:

:-1: warning: "/usr/bin/gcc" is used by qmake, but "/opt/poky/2.1.1/sysroots/i686-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. 

我试图设置mkspec我的包的配置,但结果是一样的。

+0

我试图从命令行与qmake编译,它没有错。所以这是qt创建者配置问题。 – anat0lius

+0

如果手动运行qmake工作,那么你的套件可能配置了错误的qmake –

+0

如果我打开项目配置>构建>系统环境:由setup-enviornment脚本设置的变量在那里。所以我不明白为什么它不起作用。 – anat0lius

回答

2

已解决。也许我“说谎”,说手动设置mkspec它既不工作也不工作。事实并非如此,它确实如此。这只是我有其他问题,无法正确测试。问题是mkspec这是不对的。它指向linux-g++,我将其修正为指向正确的mkspec。无论如何,Qt cretator告诉我他can't find it!所以这是一个错误?第一个问题(编译GUI)也因此得到了解决。

+0

确实,这是一个错误。已经固定在4.3上:https://codereview.qt-project.org/#/c/176005/ – anat0lius

相关问题