Search code examples
qtyoctoyocto-recipe

Yocto: recipe cannot be made due to missing directories


I am starting to work on Yocto, and trying to put in my first recipe. I already put in the layer for it, called: "meta-layer". This layer was added using the bitbake-layers (create and add) tools, and looks like this: enter image description here

With the conf/layer.conf in there looking like this:

    # We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-layer"
BBFILE_PATTERN_meta-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-layer = "6"

LAYERDEPENDS_meta-layer = "core"
LAYERSERIES_COMPAT_meta-layer = "mickledore"

And the bblayers.conf in the build folder looks like this:

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBLAYERS ?= " \
  /home/ydaelemans/workdir/poky/meta \
  /home/ydaelemans/workdir/poky/meta-poky \
  /home/ydaelemans/workdir/poky/meta-yocto-bsp \
  /home/ydaelemans/workdir/poky/meta-qt5 \
  /home/ydaelemans/workdir/poky/meta-hello \
  /home/ydaelemans/workdir/poky/build/workspace \
  /home/ydaelemans/workdir/poky/build/meta-layer \
  "

When I now add a recipe using the devtool add, it adds the recipe .bb file in the wrong place (I think?), namely in

devtool add hello /home/ydaelemans//workdir/poky/meta-layer/recipes-hello    
/home/ydaelemans/workdir/poky/build/workspace/recipes/hello/hello.bb

Which is in the build directory instead of the layer in the source directory. When trying to run here it will give errors that it cannot find the source files. So I copy it back into the layer (one level above the source files). From here I make some adjustments for it (since I am running a QT program, and yes the qt meta is already pulled and build on this setup). Now this file will look like this:

SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "CLOSED"

DEPENDS += "qtbase wayland"

SRC_URI = "file://hello.pro \
           file://main.cpp \
           file://mainwindow.cpp \
           file://mainwindow.h \
           file://mainwindow.ui \
           file://hello.pro.user \
           file://hello.pro.user \
           file://Makefile"

S = "{WORKDIR}"

do_install:append () {
#        install -d ${D}${bindir}
#        install -m 0775 qt-app ${D}${bindir}/
}

FILES_${PN} += "${bindir}/qt-app"

inherit qmake5

When I then run it using:

bitbake -b /home/ydaelemans/workdir/poky/meta-layer/recipes-hello/hello.bb

I get these errors:

dir/poky/meta-layer/recipes-hello/hello.bb
WARNING: Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.
Loading cache: 100% |########################################################| Time: 0:00:00
Loaded 1786 entries from dependency cache.

Build Configuration:
BB_VERSION           = "2.2.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "qemuarm"
DISTRO               = "poky"
DISTRO_VERSION       = "4.1"
TUNE_FEATURES        = "arm vfp cortexa15 neon thumb callconvention-hard"
TARGET_FPU           = "hard"
meta
meta-poky
meta-yocto-bsp       = "master:0ce159991d8e49f8fa97bdf5f088fdfd753a32dc"
meta-qt5             = "master:1d1b19ff577835bf847152eed44d52e8267d9093"
meta-hello
workspace
meta-layer           = "master:0ce159991d8e49f8fa97bdf5f088fdfd753a32dc"

Initialising tasks: 100% |###################################################| Time: 0:00:01
Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 0 (0% match, 0% complete)
NOTE: No setscene tasks
NOTE: Executing Tasks
ERROR: hello-1.0-r0 do_configure: ExecutionError('/home/ydaelemans/workdir/poky/build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/hello/1.0-r0/temp/run.qmake5_base_postconfigure.22783', 2, None, None)
ERROR: Logfile of failure stored in: /home/ydaelemans/workdir/poky/build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/hello/1.0-r0/temp/log.do_configure.22783
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function externalsrc_configure_prefunc
| DEBUG: Python function externalsrc_configure_prefunc finished
| DEBUG: Executing shell function qmake5_base_preconfigure
| DEBUG: Shell function qmake5_base_preconfigure finished
| DEBUG: Executing shell function do_configure
| DEBUG: Shell function do_configure finished
| DEBUG: Executing python function do_qa_configure
| DEBUG: Python function do_qa_configure finished
| DEBUG: Executing shell function qmake5_base_postconfigure
| WARNING: exit code 2 from a shell command.
| /home/ydaelemans/workdir/poky/build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/hello/1.0-r0/temp/run.qmake5_base_postconfigure.22783: 152: cannot create /home/ydaelemans/workdir/poky/build/tmp/work-shared/hello/1.0-r0/configure.sstate: Directory nonexistent
ERROR: Task (/home/ydaelemans/workdir/poky/meta-layer/recipes-hello/hello.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 7 tasks of which 6 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/ydaelemans/workdir/poky/meta-layer/recipes-hello/hello.bb:do_configure
Summary: There was 1 WARNING message.
Summary: There was 1 ERROR message, returning a non-zero exit code.

It looks like it is failing on the configuration, which I am not touching. It seems weird that I would need to make that directory by hand no? Or is that indeed what you need to do?

PS: why does devtool add put my recipe .bb file in the build directory instead of at the layers in the source directory?


Solution

  • Regarding the PATH of your recipe after devtool add, it is completely normal.

    Devtool uses a “Workspace” layer in which to accomplish builds. This layer is not specific to any single devtool command but is rather a common working area used across the tool. https://docs.yoctoproject.org/ref-manual/devtool-reference.html

    Normally after devtool add the PATH in bblayers.conf should be updated.

    Regarding the configuration error, you shouldn't create it by hand. I highly recommand you to avoid using devtool add if you are confused.

    Run bitbake -c cleanall hello

    1. Create your layer, and your recipe.
    2. Add the PATH to bblayers.conf
    3. Add in your distro file IMAGE_INSTALL_append = " Hello" (do not forget the space before Hello"

    And this it. Launch bitbake.

    Please read the documentation