Bug 14603 - cross-canadian.bbclass sets incorrect PKG_CONFIG_PATH
Summary: cross-canadian.bbclass sets incorrect PKG_CONFIG_PATH
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 3.3.3
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 3.3.5
Assignee: Anuj Mittal
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2021-10-15 10:39 UTC by Dennis
Modified: 2021-11-22 02:24 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis 2021-10-15 10:39:03 UTC
Hi,

I was trying to add debuginfod support to gdb-cross-canadian_10.1 similar to
[1] and stumbled across a possible issue with cross-canadian.bbclass.

[1]: https://docs.yoctoproject.org/3.3.3/dev-manual/common-tasks.html#using-the-debuginfod-server-method

This can be reproduced with the default configuration from hardknott-3.3.3. I use a Debian 10 build host.

Add the following package config options to local.conf:

    PACKAGECONFIG_append_pn-nativesdk-elfutils = " libdebuginfod"
    PACKAGECONFIG_append_pn-gdb-cross-canadian-x86-64 = " debuginfod tui"

Create gdb-cross-canadian_10.1.bbappend in a custom layer with:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

    PACKAGECONFIG[debuginfod] = "--with-debuginfod,--without-debuginfod,nativesdk-elfutils"

Building gdb-cross-canadian fails with the following configuration error:

    $ bitbake gdb-cross-canadian-x86-64
    ...
    checking for libdebuginfod >= 0.179... no
    configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable."
    make[1]: *** [Makefile:9368: configure-gdb] Error 1

Which should not happen since libdebuginfod is installed in the recipe sysroot:

    root@yocto-build-host:~/work/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gdb-cross-canadian-x86-64/10.1-r0/gdb-10.1# find ../ -name libdebuginfod*
    ../recipe-sysroot/opt/poky/3.3.3/sysroots/x86_64-pokysdk-linux/usr/lib/libdebuginfod.so
    ../recipe-sysroot/opt/poky/3.3.3/sysroots/x86_64-pokysdk-linux/usr/lib/libdebuginfod.so.1
    ../recipe-sysroot/opt/poky/3.3.3/sysroots/x86_64-pokysdk-linux/usr/lib/libdebuginfod-0.183.so
    ../recipe-sysroot/opt/poky/3.3.3/sysroots/x86_64-pokysdk-linux/usr/lib/pkgconfig/libdebuginfod.pc

The configure script uses pkg-config to locate libdebuginfod, pkg-config relies
on the environment variable ${PKG_CONFIG_PATH} to find the pc files. However
the value of ${PKG_CONFIG_PATH} contains an un-expanded variable ${layout_bindir}:

    root@yocto-build-host:~/work/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gdb-cross-canadian-x86-64/10.1-r0/gdb-10.1# echo $PKG_CONFIG_PATH
    /home/user/work/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gdb-cross-canadian-x86-64/10.1-r0/recipe-sysroot${layout_libdir}/pkgconfig:/home/user/work/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gdb-cross-canadian-x86-64/10.1-r0/recipe-sysroot/opt/poky/3.3.3/sysroots/x86_64-pokysdk-linux/usr/share/pkgconfig

The gdb-cross-canadian recipe inherits cross-canadian.bbclass where the
PKG_CONFIG_PATH is set and the ${layout_bindir} variable is introduced (on line 158).

I cannot find where ${layout_bindir} is supposed to be set, but when I assign
it in the append file, the build succeeds and the cross gdb in the sdk has
debuginfod support.

meta-custom/recipes-devtools/gdb/gdb-cross-canadian_10.1.bbappend:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

    layout_libdir = "${exec_prefix}/lib"
    PACKAGECONFIG[debuginfod] = "--with-debuginfod,--without-debuginfod,nativesdk-elfutils"

I'm fairly new to Yocto and not sure whether this is a mistake in
cross-canadian.bbclass or I'm just missing something.

Kind regards,
Dennis.
Comment 1 Richard Purdie 2021-11-03 15:03:54 UTC
This is a hardknott specific issue and doesn't occur in honister. I think we need http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=7c4d502c7417de5182caa52a9ab2baa7f90710cb in hardknott to fix this.

To make debuginfod work there I also found I needed OE-Core revs:

4a985ff0dd13c455dadf85f4ad35a0a42f4bd9f1: bitbake.conf: enable debuginfod in native/nativesdk
e6035099772a0ccbb4835c0c782317c19527876c: libmicrohttpd: add a recipe from meta-oe
024c88c82791a113b614abf61ffd82e097bf21d1: default-distrovars.inc: add debuginfod to default DISTRO_FEATURES
b903f250a7bbf04d5853f537b7565a80fb7ce1f3: gdb-cross: enable debuginfod

Assign to Anuj as maintainer of hardknott for the missing patch.