Reputation: 18552
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"
Upvotes: 7
Views: 15255
Reputation: 1
You could use DEPENDS
to have dependency with "poco" recipe and it would build and populate "poco" recipe's headers and libs into your recipe's sysroot.
Similar way you have to mention the export paths in the provider's recipe with FILES_*( * - package type)
Upvotes: 0
Reputation: 379
Manual recommends:
Recipes should never populate the sysroot directly:
Recommended way is (poco recipe should do something similar):
Files should be installed into standard locations:
...
do_install() {
...
install -d ${D}${includedir}
install -m 0755 ${S}/myapi.h ${D}${includedir}/
...
}
...
Than, include poco recipe as a build dependency of foo.bb :
DEPENDS += "poco"
And compile normally.
Upvotes: 5
Reputation: 6341
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: 4