yoctoopenembeddedyocto-dunfell

Error: "non debug package contains .debug directory" with Yocto recipe


I am trying to build a custom Yocto recipe, which involves compiling a small C program. During the build I get this error:

$ bitbake -f interface-configuration
...
ERROR: QA Issue: non debug package contains .debug directory: interface-configuration path /work/cortexa9hf-vfp-poky-linux-gnueabi/interface-configuration/0.1-r0/packages-split/interface-configuration/etc/interfaces/bin/.debug/set
ERROR: QA run found fatal errors. Please consider fixing them.
ERROR: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/git/poky/build-atmel/tmp/work/cortexa9hf-vfp-poky-linux-gnueabi/interface-configuration/0.1-r0/temp/log.do_package.28986
ERROR: Task 10 (/home/git/poky/meta-atmel/recipes-intelli/interface-configuration/interface-configuration_0.1.bb, do_package) failed with exit code '1'

I was wondering if anyone knows how to either disable debug info or remove the QA check. Google search for the error has proven fruitless so far.

This is my custom recipe interface-configuration.bb:

DESCRIPTION = "Interface configuration files and tools"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
SRC_URI = "file://interface-configuration-0.1.tar.gz"

do_compile() {
    install -vd ${D}/
    ${CC} -g0 set.c -o set
    # CC is arm-poky-linux-gnueabi-gcc -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a9 --sysroot=/home/git/poky/build-atmel/tmp/sysroots/sama5d3xek
}


do_install() {
    cp -r ${S}/etc ${D}/etc
    install -vd ${D}/etc/interfaces/bin
    install -vm 0755 set ${D}/etc/interfaces/bin/
}

do_install_append() {
    # I added this to try to remove the error - it doesn't work
    rm -rf ${D}/etc/interfaces/bin/.debug
}

FILES_${PN} += "/etc/interfaces/MANIFEST \
    /etc/interfaces/conf/A \
    /etc/interfaces/conf/B \
    /etc/interfaces/conf/C \
    /etc/interfaces/conf/D \
    /etc/interfaces/template/A \
    /etc/interfaces/template/B \
    /etc/interfaces/template/C \
    /etc/interfaces/template/D \
    /set.c"

Solution

  • Yocto/OE generate a .debug-directory under the directory where the binary is placed. You use a non default directory for a binary (install -vm 0755 set ${D}/etc/interfaces/bin). You need to declare that .debug goes to the -dbg package.

    You have two options now. First use of standard directory like ${D}/usr/bin or second you add .debug to dbg - packages like this:

    FILES_${PN}-dbg += "/etc/interfaces/bin/.debug"
    

    You can remove your do_install_append because the .debug is created after do_install.

    If you use the second option you have to need to configure your gdb with set debug-file-directory directories option in gdb to debug you binary. Read more here