yoctobitbakebpfbccbpftrace

How to use dynamic layers in yocto?


I am new to Yocto. I am using Yocto scarthgap release and have cloned poky. I wanted to add support for bcc and bpftrace, hence trying to add meta-clang layer.

The layer shows up for me

$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer                 path                                                                    priority
========================================================================================================
core                  /mnt/secondary/poky/meta                                                5
yocto                 /mnt/secondary/poky/meta-poky                                           5
yoctobsp              /mnt/secondary/poky/meta-yocto-bsp                                      5
openembedded-layer    /mnt/secondary/poky/meta-openembedded/meta-oe                           5
clang-layer           /mnt/secondary/poky/meta-clang

And this is how my directory structure of poky looks like (meta-clang cloned inside poky) :

$ ls
bitbake        LICENSE.GPL-2.0-only  meta-clang         meta-yocto-bsp      README.poky.md
build          LICENSE.MIT           meta-openembedded  oe-init-build-env   README.qemu.md
contrib        MAINTAINERS.md        meta-poky          README.hardware.md  scripts
documentation  MEMORIAM              meta-selftest      README.md           SECURITY.md
LICENSE        meta                  meta-skeleton      README.OE-Core.md

But the problem is that I do not see bcc recipe, bpftrace recipe is seen fine though.

$ bitbake-layers show-recipes | grep bpftrace
bpftrace:
$ bitbake-layers show-recipes | grep bcc
$

In the source of meta-clang I see both recipes are present. Why bcc is not seen and how can I fix it?

meta-clang/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb
meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb

And the build fails as expected :

$ bitbake core-image-minimal
Loading cache: 100% |                                                                     | ETA:  --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |####################################################################| Time: 0:00:30
Parsing of 1888 .bb files complete (0 cached, 1888 parsed). 3246 targets, 116 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
ERROR: Nothing PROVIDES 'bcc' (but /mnt/secondary/poky/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb DEPENDS on or otherwise requires it). Close matches:
  bc
  byacc
NOTE: Runtime target 'bpftrace' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['bpftrace', 'bcc']
ERROR: Required build target 'core-image-minimal' has no buildable providers.
Missing or unbuildable dependency chain was: ['core-image-minimal', 'bpftrace', 'bcc']

Summary: There were 2 ERROR messages, returning a non-zero exit code.

Solution

  • Please note that bcc recipe in meta-clang is placed under dynamic-layer for meta-python which means that it will only be activated if meta-python is added to the BBLAYERS, looking at the output of bitbake-layers show-layers above I see that your project does not add meta-python to list of layers. So please add it. You can edit conf/bblayers.conf file directly and add it manally or use bitbake-layers add-layer see https://docs.yoctoproject.org/dev/dev-manual/layers.html#adding-a-layer-using-the-bitbake-layers-script