Bug 14365 - lame: os.path.relpath gives abs path for rpath in chrpath.bbclass
Summary: lame: os.path.relpath gives abs path for rpath in chrpath.bbclass
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: unspecified
Hardware: x86 x86_64
: Medium major
Target Milestone: 6.2
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2021-04-26 21:08 UTC by guymon.hall
Modified: 2026-10-01 15:48 UTC (History)
4 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 guymon.hall 2021-04-26 21:08:24 UTC
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: ['nativesdk-gcc-runtime', 'nativesdk-glibc', 'nativesdk-ncurses', 'nativesdk-libgcc', 'nativesdk-linux-libc-headers', 'nativesdk-opkg-utils']
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 '$ORIGIN/../../../../../../../home/user/project/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-lame/3.100-r0/build/libmp3lame/.libs' 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("$ORIGIN/" + os.path.relpath(rpath, os.path.dirname(fpath.replace(rootdir, "/"))))
---

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

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

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

However, this error only occurs when building nativesdk-lame. Other sdk packages build fine as is.
Comment 1 Randy MacLeod 2021-04-29 15:06:44 UTC
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?
Comment 2 Randy MacLeod 2021-10-20 21:04:47 UTC
Guymon, See previous comment. Is this still a problem for you?
Comment 3 Richard Purdie 2021-10-28 15:34:01 UTC
I tested with BBCLASSEXTEND = "nativesdk" in the lame recipe in OE-Core with "bitbake nativesdk-lame" and confirm this does show the reported error.
Comment 4 Paulo Neves 2022-07-27 09:20:00 UTC
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.
Comment 5 Randy MacLeod 2022-11-03 15:11:25 UTC
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.
Comment 6 Randy MacLeod 2022-12-15 15:54:47 UTC
Richard is going to take a look since the patch submitted was a good start but not sufficient.
Comment 7 Paulo Neves 2022-12-15 16:22:42 UTC
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.