#include <botan/botan.h> Yocto 编译中没有这样的文件或目录

#include <botan/botan.h> no such file or directory in Yocto compilation

嗨,我已经从 http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-crypto/botan/botan_2.14.0.bb?h=master 中包含了 botan_2.14.0.bb,并且我已经将它烘焙到我的 yocto 版本中。 以下是 rpm 结果:

-rw-r--r-- 2 kjlau kjlau   155436 Jul   7 11:12 libbotan-2-bin-2.14.0-r0.cortexa8hf_neon.rpm
-rw-r--r-- 2 kjlau kjlau   246916 Jul   7 11:12 libbotan-2-doc-2.14.0-r0.cortexa8hf_neon.rpm
-rw-r--r-- 2 kjlau kjlau    16376 Jul   7 11:12 libbotan-2-python3-2.14.0-r0.cortexa8hf_neon.rpm
-rw-r--r-- 2 kjlau kjlau   255764 Jul   7 11:12 libbotan-2-dev-2.14.0-r0.cortexa8hf_neon.rpm
-rw-r--r-- 2 kjlau kjlau  1443276 Jul   7 11:12 libbotan-2-13-2.14.0-r0.cortexa8hf_neon.rpm
-rw-r--r-- 2 kjlau kjlau 19660652 Jul   7 11:13 libbotan-2-dbg-2.14.0-r0.cortexa8hf_neon.rpm

我尝试构建一个包含 botan header #include 的应用程序,我收到错误消息,没有这样的文件或目录。以下是botanapp.bb内容

DECRIPTION = "Simple helloworld application"
LICENSE = "CLOSED"
DEPENDS = "botan"
PACKAGES = "${PN} ${PN}-dbg"
SRC_URI = "file://app.cpp"

S = "${WORKDIR}"
CXXFLAGS = "-g -std=gnu++11"
inherit pkgconfig autotools

do_compile() {
    
     ${CXX} ${CXXFLAGS} ${LDFLAGS} -I ${includedir}/botan-2/botan   ${S}/app.cpp -lbotan-2  -o ${S}/myBotan
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755  ${WORKDIR}/myBotan ${D}${bindir}
}

FILES_${PN} += " \
        ${bindir}/myBotan \
"

我已经检查了我的 botanapp recipe-sysroot 的 botanapp

$build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/botanapp/1.0-r0/recipe-sysroot/usr/include/botan-2/botan
$ ls botan*
    botan.h

header可用,我不确定wrong.To我的知识,我需要做这样的事情

g++ app.cpp -I/usr/local/include/botan-2 -lbotan-2

在ubuntu中编译botan代码。如果我做错了什么,请告诉我。

您需要的是STAGING_INCDIR。 ${includedir} 是图像中文件所在的位置。以此类推。

但是有了 DEPENDS,您要求 Yocto 准备一个 sysroot,其中包含构建配方的所有内容。 STAGING_INCDIR 指向那个 sysroot。

A includedir 可以使用,例如告诉安装命令将文件放在映像中的什么位置。

很容易找出所有其他食谱是如何做到的。 您源代码中的 grep -r ' -I' 将指向许多使用编译器命令的配方。

do_compile() {
     ${CXX} ${CXXFLAGS} ${LDFLAGS}  -o ${S}/botanBinary -I ${STAGING_DIR_TARGET}/${includedir}/botan-2 ${S}/app.cpp  -lbotan-2 
}

这对我有用,如果有任何不合理之处请告诉我。谢谢