My program depends on the poco
recipes, which provides both the header files and shared libraries. However, I cannot make use of the header files from poco
in my recipe, which leads to the error Poco/Delegate.h: No such file for directory
.
How do I make the header available at build time for my software package?
Here is an example recipe:
SUMMARY = ""
DESCRIPTION = ""
AUTHOR = ""
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
HOMEPAGE = ""
BUGTRACKER = ""
S = "${WORKDIR}"
SRC_URI = " file://foo.cpp \
file://CMakeLists.txt \
"
inherit pkgconfig cmake
DEPENDS_foo = "poco"
RDEPENDS_foo = "poco"
do_install() {
install -d ${D}/${bindir}
install -m 755 ${S}/foo ${D}/${bindir}
}
FILES_${PN} = "${bindir}/foo"
Adding new recipes to the build system One way is to simply create a new recipe_version.bb file in a recipe-foo/recipe folder within one of the existing layers used by Yocto.
WORKDIR. The pathname of the work directory in which the OpenEmbedded build system builds a recipe. This directory is located within the TMPDIR directory structure and is specific to the recipe being built and the system for which it is being built.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With