Mohammed Harris
Mohammed Harris

Reputation: 396

Bitbake cannot find the header file of another recipe

I am having a package which is depending on asterisk. As it is depending on asterisk I included DEPENDS = "asterisk" in bitbake file.But my source package cannot locate "asterisk.h" which is available in asterisk package.I tried "bitbake asterisk -c listtasks" in this command [do_populate_sysroot] was available.But from where bitbake is expecting the asterisk.h to reside, so that it can fetch from there. Following is the log error I am getting while compiling my recipe.

checking for string.h... (cached) yes
 checking for sys/time.h... (cached) yes
 checking for termios.h... (cached) yes
 checking whether asterisk.h in ../include... no
 checking whether asterisk.h in /usr/include... no
 checking whether asterisk.h in /usr/local/include... no
 checking whether asterisk.h in /opt/local/include... no
 configure: error: Can't find "asterisk.h"

NOTE: The following config.log files may provide further information.

Upvotes: 3

Views: 3428

Answers (1)

Zephyr
Zephyr

Reputation: 6351

We can use provider and user to illustrate this case, the package (recipe) provides a header file to be used by another package (recipe) is the provider, the package (recipe) use a header file from another package (recipe) is the user.

First we change the provider's recipe (myprovider.bb) to export the header file -- myapi.h,

...
do_install() {

    install -d ${D}/${bindir}
    install -m 755 ${B}/hello_provider ${D}/${bindir}

    install -d ${D}${libdir}/lib_myprovider/
    install -m 0755 ${WORKDIR}/myapi.h ${STAGING_DIR_TARGET}${libdir}/lib_myprovider/
}
...

Secondly we change the user's recipe (myuser.bb) to refer the header file -- myapi.h

...
do_compile () {    

    ${CC} ${WORKDIR}/main.c -o hello_user ${CFLAGS} ${LDFLAGS} -I${STAGING_DIR_TARGET}/${libdir}/lib_myprovider/ 
}

# file dependency declaration
FILES_${PN} = "${libdir}/lib_myprovider"

# package dependency declaration
DEPENDS += "myprovider"
...

At last, rebuild myprovider.bb and myuser.bb recipes, it should work.

Upvotes: 1

Related Questions