I need to install a native script, call it foo, in one recipe (foo-native) and then use it in the do_compile step of another (target) recipe - call it bar.
My (minimal) native recipe
SRC_URI = "file://foo"
LICENSE = "CLOSED"
inherit native
BBCLASSEXTEND = "native"
S = "${WORKDIR}"
do_compile() { 
    : 
}
do_install() {
    install -d ${D}/usr/bin
    install ${WORKDIR}/foo ${D}/usr/bin
}
The script, foo, exists in a directory called files which resides next to the recipe. i.e.
foo/
├── files
│   └── foo
└── foo.bb
My target recipe for bar
SRC_URI = ""
LICENSE = "CLOSED"
DEPENDS = "foo-native"
do_fetch[noexec] = "1"
do_configure[noexec] = "1"
do_compile() {
    foo >myfile.json
}
do_install() {
    install -d ${D}/etc
    install ${WORKDIR}/myfile.json ${D}/etc
}
The error I get is in the do_compile task of bar, and it simply says that foo can not be found (i.e. has not been installed into a directory on the path).
First, you don't need the line
inherit native
in foo.bb. It's taken care of for you by BBCLASSEXTEND = "native".
Secondly, change your do_install to:
do_install() {
    install -d ${D}${bindir}
    install ${WORKDIR}/foo ${D}${bindir}
}
Note: use ${bindir} instead of /usr/bin. ${bindir} is determined using ${prefix}, which in turn is changed e.g. when building a -native version of a recipe.
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