2017-03-06 48 views
1

我有一個工作在Yocto Krogoth上的Nitrogen6x主板,下一個版本使用core-image-sato。我已經安裝了Qt Creator 3.5.1(基於Qt 5.5.1),並根據[Build & Install Qt5 toolchain]文件添加了我的氮氣6x板套件。我已經添加了一個示例Qt快速應用程序,並選擇了Qt Quick 2.1作爲組件集並嘗試編譯源代碼,我注意到下面的錯誤。Yocto/Qt5.6:無法構建示例Qt應用程序

19:04:25: Running steps for project untitled6... 
19:04:25: Starting: "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" /home/test/untitled6/untitled6.pro -r -spec linux-g++ 
19:04:25: The process "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" exited normally. 
19:04:25: Starting: "/usr/bin/make" 
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o main.o ../untitled6/main.cpp 
/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/rcc -name qml ../untitled6/qml.qrc -o qrc_qml.cpp 
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o qrc_qml.o qrc_qml.cpp 
g++ -Wl,-O1 -o untitled6 main.o qrc_qml.o -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread 
/usr/bin/ld: cannot find -lQt5Quick 
/usr/bin/ld: cannot find -lQt5Gui 
/usr/bin/ld: cannot find -lQt5Qml 
/usr/bin/ld: cannot find -lQt5Network 
/usr/bin/ld: cannot find -lQt5Core 
/usr/bin/ld: cannot find -lGLESv2 
collect2: ld returned 1 exit status 
make: *** [untitled6] Error 1 
19:04:26: The process "/usr/bin/make" exited with code 2. 
Error while building/deploying project untitled6 (kit: Nitrogen) 
When executing step 'Make' 
19:04:26: Elapsed time: 00:01. 

所有Qt庫是/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/下存在和我有我的包下正確設置SYSROOT路徑,但我無法弄清楚這是爲什麼我的應用程序無法引用這些庫。任何對此的幫助深表謝意。提前致謝。

回答

1

的mkspec指向你的包似乎是錯誤的一個(linux-g++),從您的構建日誌

-I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ 

報價時爲建設一個nitrogen6x,它應該有可能是linux-oe-g++代替。這可以在您選擇的Qt版本中默認設置,或者可以通過在QtCreator的選項下的「mkspec」下修改Kit本身來設置。

您看到的錯誤可能是由於庫所指向的ABI &體系結構與您編譯的x86/64代碼不兼容。

如果遇到問題(即編譯關於「C」未找到的錯誤),請確保在啓動QtCreator之前獲取Yocto的環境文件。這將設置交叉編譯器的路徑。例如:

source /opt/poky/1.6.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi 
~/Qt/Tools/QtCreator/bin/qtcreator 
+0

是的。我嘗試在我的工具包中添加'linux-oe-g ++''Qt mkspec'。我注意到錯誤'make:c:Command not found'。然後,我嘗試在我的'〜/ Qt/Tools/QtCreator/bin/qtcreator.sh'腳本中添加'source /opt/poky/ 2.1.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi', !/ bin/sh',然後啓動'sudo sh qtcreator.sh'並嘗試構建並運行。非常感謝你。 – user12345

+0

很高興幫助:) –