Search code examples
yoctobitbakeyocto-wic

Bitbake failed with exit code '1' when using multiple cores


Problem

Multiple Cores

When Bitbake is called with multiple cores (-j 4), it fails with exit code '1' with the following error message:

| WARNING: Backtrace (BB generated script): | #1: do_image_wic, /yocto/tmp/work/intel_corei7_64-poky-linux/weston-dev-image/1.0-r0/temp/run.do_image_wic.69326, line 163 | #2: main, /yocto/tmp/work/intel_corei7_64-poky-linux/weston-dev-image/1.0-r0/temp/run.do_image_wic.69326, line 179 ERROR: Task (/yocto/poky/build-weston-64/weston-self-installer/../../../meta-test/meta-builds/recipes-images/images/weston-dev-image.bb:do_image_wic) failed with exit code '1' NOTE: Tasks Summary: Attempted 6603 tasks of which 6593 didn't need to be rerun and 1 failed.

The following local.conf was used:

WKS_FILE = "image-installer.wks.in"
IMAGE_FSTYPES:append = " ext4"
IMAGE_TYPEDEP_wic = "ext4"
INITRD_IMAGE_LIVE="core-image-minimal-initramfs"

do_rootfs[depends] += "virtual/kernel:do_deploy"
do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"

Temporary Solution

Rerun

If you run the bitbake building again, it works and we have a successful build.

It might be incorrect, but what I saw was that 2 jobs were running, do_image_wic and do_image_ext4. However, do_image_wic finishes before do_image_ext4, but has do_image_ext4 as a dependancy.

Is there a way to run bitbake to build Yocto with multiple cores and make do_image_wic wait for do_image_ext4 to finish?

Single Core

If we change the yocto building configuration to -j 1, it build without errors.

Question

What is the solution to this build order problem?


Solution

  • The following local.conf was used to fix:

    WKS_FILE = "image-installer.wks.in"
    IMAGE_FSTYPES:append = " ext4"
    IMAGE_TYPEDEP_wic = "ext4"
    INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
    
    do_rootfs[depends] += "virtual/kernel:do_deploy"
    do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
    do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_ext4"
    

    It was missing do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_ext4" to wait for the image ext4 completion before initializing do_image_wic()