<?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>14365</bug_id>
          
          <creation_ts>2021-04-26 21:08:24 +0000</creation_ts>
          <short_desc>lame: os.path.relpath gives abs path for rpath in chrpath.bbclass</short_desc>
          <delta_ts>2026-10-01 15:48:10 +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>oe-core other</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>6.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>guymon.hall</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>guymon.hall</cc>
    
    <cc>ptsneves</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</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>90128</commentid>
    <comment_count>0</comment_count>
    <who name="">guymon.hall</who>
    <bug_when>2021-04-26 21:08:24 +0000</bug_when>
    <thetext>When building nativesdk-lame, an error is encountered in process_file_linux in chrpath.bbclass. From the logs:

---
DEBUG: Executing python function package_prepare_pkgdata
NOTE: Installed into pkgdata-sysroot: [&apos;nativesdk-gcc-runtime&apos;, &apos;nativesdk-glibc&apos;, &apos;nativesdk-ncurses&apos;, &apos;nativesdk-libgcc&apos;, &apos;nativesdk-linux-libc-headers&apos;, &apos;nativesdk-opkg-utils&apos;]
DEBUG: Python function package_prepare_pkgdata finished
DEBUG: Executing python function perform_packagecopy
DEBUG: Checking /home/user/project/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-lame/3.100-r0/package//opt/tdx-xwayland/5.2.0/sysroots/x86_64-tdxsdk-linux/usr/bin for binaries to process
ERROR: chrpath command failed with exit code 7:
/home/user/project/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-lame/3.100-r0/package/opt/tdx-xwayland/5.2.0/sysroots/x86_64-tdxsdk-linux/usr/bin/lame: RPATH=/home/user/project/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-lame/3.100-r0/build/libmp3lame/.libs

new rpath &apos;$ORIGIN/../../../../../../../home/user/project/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-lame/3.100-r0/build/libmp3lame/.libs&apos; too large; maximum length 122

DEBUG: Python function perform_packagecopy finished
---

The issue occurs on line 42 of chrpath.bbclass in process_file_linux:

---
new_rpaths.append(&quot;$ORIGIN/&quot; + os.path.relpath(rpath, os.path.dirname(fpath.replace(rootdir, &quot;/&quot;))))
---

os.path.relpath appends the abs path instead of the actual rel path, causing the string length to exceed chrpath&apos;s requirements. This occurs when fpath.replace substitutes &quot;/&quot; for the rootdir.

When I remove fpath.replace and just use plain ol&apos; fpath, it works as expected and calculates the correct rel path:

---
new_rpaths.append(&quot;$ORIGIN/&quot; + os.path.relpath(rpath, fpath))
---

However, this error only occurs when building nativesdk-lame. Other sdk packages build fine as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90166</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-04-29 15:06:44 +0000</bug_when>
    <thetext>Seems like the lame recipe may be passing in bad data rather than the problem being with chrpath.bbclass 

Could you print fpath or provide a reproducer?
What version/commit are you using for oe-core/bitbake/poky?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91791</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-10-20 21:04:47 +0000</bug_when>
    <thetext>Guymon, See previous comment. Is this still a problem for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91847</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-10-28 15:34:01 +0000</bug_when>
    <thetext>I tested with BBCLASSEXTEND = &quot;nativesdk&quot; in the lame recipe in OE-Core with &quot;bitbake nativesdk-lame&quot; and confirm this does show the reported error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93704</commentid>
    <comment_count>4</comment_count>
    <who name="Paulo Neves">ptsneves</who>
    <bug_when>2022-07-27 09:20:00 +0000</bug_when>
    <thetext>Tentative patch in https://lore.kernel.org/openembedded-core/20220726202337.2141895-1-ptsneves@gmail.com/T/#t

It turns out there was a host contamination and the rpath should not be set at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94354</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-11-03 15:11:25 +0000</bug_when>
    <thetext>Can you summarize where we are with this bug.
Richard thinks that there has been some progres...

We were reviewing it during the YP bugboard.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94532</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-12-15 15:54:47 +0000</bug_when>
    <thetext>Richard is going to take a look since the patch submitted was a good start but not sufficient.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94533</commentid>
    <comment_count>7</comment_count>
    <who name="Paulo Neves">ptsneves</who>
    <bug_when>2022-12-15 16:22:42 +0000</bug_when>
    <thetext>I am sorry i have not progressed on this. I have been busy with family topics and currently do not have the bandwidth. My apologies.

The current status is that the patch fixes the symptoms but may be hiding an underlying issue in libtools itself.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>