Search code examples
yoctobitbakebotan

#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. below is the rpm outcome:

-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. Below is botanapp.bb contents

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

$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

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

to compile botan code in ubuntu. Kindly let me know if i do anything wrong.


Solution

  • 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