Re: Compiling a simple command

Nicolas Dechesne <nicolas.dechesne@...>

On Thu, Jun 20, 2013 at 6:08 PM, Paul D. DeRocco <pderocco@...> wrote:
I've tried to add a single small executable to my image, based on what it
says in 5.3.1. of the Project Development Manual, and while the image gets
built with no error messages, it never compiles my executable. I'm not doing
_exactly_ what it says, so I assume some difference is accounting for this
failure. What I'm doing different:

1) Since I'm only adding one tiny little program to an otherwise default
image, I'm not creating a separate .bb file for it, but placing it in the
top-level .bb file that I invoke with the bitbake command.

2) Since I only have one .bb file, I'm sticking it in the layer directory,
not two levels down, and adding ${LAYERDIR}/*.bb to BBFILES.

It's finding the recipe okay, because the image is being built, but it's
never executing do_compile or do_install. The recipe looks like this:

require recipes-core/images/

DESCRIPTION = "A basic image with a realtime kernel."
DEPENDS = "linux-yocto-rt"
PR = "r0"

SRC_URI = "file://fastuart.cpp"

S = "${WORKDIR}"

do_compile() {
    ${CC} fastuart.cpp -o fastuart

do_install() {
    install -d ${D}${bindir}
    install -m 0755 fastuart ${D}${bindir}

here you are mixing a recipe for an image with a recipe for a 'package', and that's wrong. you have recipes for images, and recipes for packages.  for package, bitbake will actually do the standard fetch/unpack/patch/configure/compile/package steps, but not for images. all images recipe inherit from image.bbclass, and if you check that file you can see that all 'normal package' tasks are disabled (toward the end of the file)

so, while your recipe is indeed syntactically correct, the do_compile() and do_install() aren't never really called.

you need to make a separate recipe for your package, e.g. (and removes the 'require' at the beginning).

then you can create your image recipe, and request your package to be installed in the image , you can do something like that:

require recipes-core/images/
IMAGE_INSTALL += 'fastuart'

Join { to automatically receive all group messages.