Search code examples
sdkavroyoctobitbakeopenembedded

How to add do_populate_sdk task to avro-c BitBake recipe?


This question is specific to avro-c, but the solution may be generalized to other packages in the OpenEmbedded BitBake system.

How do I create a do_populate_sdk task for avro-c?

I want to generate a Yocto SDK which includes avro-c. The avro-c layer in meta-openembedded is very small:

avro
├── avro-c
│   └── 0001-avro-c-Fix-build-with-clang-compiler.patch
└── avro-c_1.8.1.bb

The avro-c_1.8.1.bb recipe is only 20 lines:

SUMMARY = "Apache Avro data serialization system."
HOMEPAGE = "http://apr.apache.org/"
SECTION = "libs"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=73bdf70f268f0b3b9c5a83dd7a6f3324"

DEPENDS = "jansson zlib xz"
PV .= "+git${SRCPV}"

SRCREV = "4b3677c32b879e0e7f717eb95f9135ac654da760"
SRC_URI = "git://github.com/apache/avro \
       file://0001-avro-c-Fix-build-with-clang-compiler.patch;patchdir=../../ \
"

S = "${WORKDIR}/git/lang/c"

LDFLAGS_append_libc-uclibc = " -lm"

inherit cmake

A target image which includes avro-c builds successfully, and ls /usr/bin/avro* lists the Avro functions.

However, avro-c is not included in the host SDK build. One way to troubleshoot this is to try the two commands:

$ bitbake avro-c
$ bitbake avro-c -c populate_sdk

The first command completes successfully. The second command fails with the following error messages:

ERROR: Task do_populate_sdk does not exist for target avro-c (/home/rdepew/workspace/clean1/build/../layers/meta-sporian/recipes-support/avro/avro-c_1.8.1.bb:do_populate_sdk). Close matches:
do_populate_lic
do_populate_sysroot
ERROR: Command execution failed: 1

I looked for clues in the other layers in my build system. It appeared that creating the file avro-c_%.bbappend, containing the single line

inherit nativesdk

might do the trick, but that generated two more BitBake error messages:

ERROR: Nothing PROVIDES 'virtual/x86_64-pokysdk-linux-compilerlibs' (but /home/rdepew/workspace/clean1/build/../layers/meta-sporian/recipes-support/avro/avro-c_1.8.1.bb DEPENDS on or otherwise requires it). Close matches:
virtual/nativesdk-x86_64-pokysdk-linux-compilerlibs
virtual/x86_64-pokysdk-linux-go-crosssdk
virtual/x86_64-pokysdk-linux-gcc-crosssdk
ERROR: Required build target 'avro-c' has no buildable providers.
Missing or unbuildable dependency chain was: ['avro-c', 'virtual/x86_64-pokysdk-linux-compilerlibs']

... and that's where I'm stuck. I'm not sure where to go from here.

Online places that I have researched:

I don't know if it's appropriate to list the URLS of places where I have looked for the answer. They include the GitHub repository for Avro, the Yocto Project ADT manual, and four related questions on StackOverflow. If it's appropriate, I will edit this question to include the URLs.


Solution

  • The right way to add something to SDK (or eSDK - Extended SDK) is via the image of your choice. So, the steps are:

    • Add a package to the image:

      IMAGE_INSTALL_append = " avro-c"

    • Create Yocto SDK for an image of your choice:

      bitbake core-image-full-cmdline -c populate_sdk

    • Create Yocto eSDK for an image of your choice:

      bitbake core-image-full-cmdline -c populate_sdk_ext

    Have fun! :-)