<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14603</bug_id>
          
          <creation_ts>2021-10-15 10:39:03 +0000</creation_ts>
          <short_desc>cross-canadian.bbclass sets incorrect PKG_CONFIG_PATH</short_desc>
          <delta_ts>2021-11-22 02:24:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>3.3.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.3.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dennis">dennis.peeten</reporter>
          <assigned_to name="Anuj Mittal">anuj.mittal</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>91764</commentid>
    <comment_count>0</comment_count>
    <who name="Dennis">dennis.peeten</who>
    <bug_when>2021-10-15 10:39:03 +0000</bug_when>
    <thetext>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 = &quot; libdebuginfod&quot;
    PACKAGECONFIG_append_pn-gdb-cross-canadian-x86-64 = &quot; debuginfod tui&quot;

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

    FILESEXTRAPATHS_prepend := &quot;${THISDIR}/${PN}:&quot;

    PACKAGECONFIG[debuginfod] = &quot;--with-debuginfod,--without-debuginfod,nativesdk-elfutils&quot;

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

    $ bitbake gdb-cross-canadian-x86-64
    ...
    checking for libdebuginfod &gt;= 0.179... no
    configure: error: &quot;--with-debuginfod was given, but libdebuginfod is missing or unusable.&quot;
    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 := &quot;${THISDIR}/${PN}:&quot;

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

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

Kind regards,
Dennis.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91884</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-11-03 15:03:54 +0000</bug_when>
    <thetext>This is a hardknott specific issue and doesn&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92053</commentid>
    <comment_count>2</comment_count>
    <who name="Anuj Mittal">anuj.mittal</who>
    <bug_when>2021-11-22 02:24:14 +0000</bug_when>
    <thetext>The fix has been merged in hardknott.

https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=hardknott&amp;id=e3db5c70da5448a1491e2e4823869811f0e1ec6e</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>