2016-11-04 122 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

相關問題