2017-07-28 102 views
0

我覺得我一定在做一些根本性的錯誤。我創建了一個基於cmake項目的配方。編譯使用創建工具鏈yocto項目是運行cmake的然後使一樣簡單,但它不能使用配方編譯:基於cmake的bitbake配方:sysroot缺失?

SUMMARY = "Opendnp3 is the de facto reference implementation of IEEE-1815 (DNP3)" 
DESCRIPTION = "Opendnp3 is a portable, scalable, and rigorously tested implementation of the DNP3 (www.dnp.org) protocol stack written in C++11. The library is designed for high-performance applications like many concurrent TCP sessions or huge device simulations. It also embeds very nicely on Linux." 
HOMEPAGE = "https://www.automatak.com/opendnp3" 
SECTION = "libs" 
DEPENDS = "asio" 
LICENSE = "Apache-2.0" 
LIC_FILES_CHKSUM = "file://NOTICE;md5=9788d3abe6c9401d72fdb3717de33e6a" 
SRCREV = "e00ff31b837821064e5208c15866a9d46f8777b1" 
SRC_URI = "git://github.com/automatak/dnp3;branch=2.0.x" 
S = "${WORKDIR}/git" 
inherit cmake 
EXTRA_OECMAKE += "" 

問題是我想的是,用於克CXXFLAGS ++不會出現以與由工具鏈環境定義的CXXFLAGS保持一致。主要是--sysroot丟失,g ++無法找到標準C++頭文件(例如:cstdint)。

我部分地由從cmake.bbclas重寫do_configure簡單地通過除去-DCMAKE_TOOLCHAIN_FILE = $ {WORKDIR} /toolchain.cmake固定的問題。

-march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 --sysroot=/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0=/usr/src/debug/dnp3/2.2.0-r0 -fdebug-prefix-map=/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0/recipe-sysroot= -fvisibility-inlines-hidden -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 --sysroot=/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0/recipe-sysroot 

所以SYSROOT定義(兩次實際上)爲:事實上CXXFLAGS的問題是由toolchain.cmake定義

/home/star/moxa-build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/dnp3/2.2.0-r0/recipe-sysroot 

但在Makefile中並沒有結束上升cmake的產生所以我猜想toolchain.cmake中的某些東西會使項目的cmake配置向南。

原來這是項目本身的一個cmake問題。在其中一個包含的.cmake配置文件中,C和CXX標誌之間出現了混淆。我會向維護者提交一個請求。 CXXFLAGS在SDK(直接包含在CXX命令中)和bitbake之間的處理方式不同,它解釋了爲什麼它可以與SDK協同工作(儘管如此,仍然不太清楚它爲什麼在沒有toolchain.cmake的情況下運行)。

謝謝。

+0

你可以發佈錯誤,當你bitbake食譜?您是否嘗試過沒有EXTRA_OECMAKE行? – Katu

+0

當然。配方編譯日誌是[here](https://drive.google.com/open?id=0B_Ag-ilTJ9VVaFhyZTVLMGVIdHc)。刪除該行時的結果相同_EXTRA_OECMAKE + =「」_ – Louis

+0

我會檢查錯誤「致命錯誤:cstdint:沒有這樣的文件或目錄」。有些人建議您需要將gcc-multilib添加到圖像中。 https://lists.yoctoproject.org/pipermail/yocto/2014-September/021760.html – Katu

回答

0

--sysrootCXXFLAGS丟失,因爲yocto將其填入CXX變量本身。請注意,除了sysroots目錄外,yocto還將有一個environment-setup-XXX文件,您應該提供該文件。這就是所有系統根源的來源。

+0

謝謝。當我提供yocto工具鏈提供的腳本時(在這種情況下,_environment-setup-cortexa8hf-neon-poky-linux-gnueabi_)_CXX_被定義爲_arm-poky-linux-gnueabi-g ++ -march = armv7 -a -mfpu = neon -mfloat-abi = hard -mcpu = cortex-a8 -sysroot =/opt/poky/2.3/sysroots/cortexa8hf-neon-poky-linux-gnueabi_並調用主機的_cmake_和_make_在該環境下順利進行。我會假設通過配方使用相同的環境,但是cmake和make的實現可能會有所不同。 – Louis

+0

@Louis:我不知道你指的是哪個「cmake的實現」。 AFAIK在'/ opt/poky'下面沒有單獨的'make'。爲什麼需要一個? – MSalters

+0

我指的是Ross Burton的帖子(見下文)。我的理解是,bitbake不使用主機上安裝的cmake – Louis