简体   繁体   English

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

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

HI i have include botan_2.14.0.bb from http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-crypto/botan/botan_2.14.0.bb?h=master and i have bitbake it into my yocto build.嗨,我已经包含了来自http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-crypto/botan/botan_2.14.0.bb?h=master的 botan_2.14.0.bb,我已经对其进行了 bitbake进入我的 yocto 构建。 below is the rpm outcome:以下是 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

i try build a application with include the botan header #include <botan/botan.h>, i am getting error no such file or directory.我尝试构建一个包含 botan header #include <botan/botan.h> 的应用程序,我收到错误没有这样的文件或目录。 Below is botanapp.bb contents以下是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 \
"

i have check my botanapp recipe-sysroot of botanapp我检查了我的botanapp recipe-sysroot of botanapp

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

The header is available, i am not sure what wrong.To my knowledge, i need do something like this header 可用,我不知道出了什么问题。据我所知,我需要做这样的事情

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

to compile botan code in ubuntu.在 ubuntu 中编译植物代码。 Kindly let me know if i do anything wrong.如果我做错了什么,请告诉我。

What you needed is STAGING_INCDIR .您需要的是STAGING_INCDIR The ${includedir} is where the files will be at the image. ${includedir} 是文件在图像中的位置。 And so on the target.等等目标。

But with DEPENDS, you ask Yocto to prepare a sysroot with everything there to build the recipe.但是使用 DEPENDS,您要求 Yocto 准备一个 sysroot,其中包含用于构建配方的所有内容。 And STAGING_INCDIR is pointing to that sysroot. STAGING_INCDIR 指向那个 sysroot。

A includedir can be used eg to tell the install command where to put the files in the image.可以使用includedir ,例如告诉安装命令将文件放在映像中的什么位置。

It's rather easy to find out how all others recipes are doing it.很容易找出所有其他食谱是如何做到的。 A grep -r ' -I' in you sources will point to many recipes where a compiler command is used.您的源代码中的grep -r ' -I'将指向许多使用编译器命令的配方。

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

This work for me, let me know if anything does not make sense.这对我有用,让我知道是否有任何不妥之处。 thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM