diff mbox series

[1/2] libclc: Fix absolute symlinks in sysroot

Message ID 20250730043809.1486481-1-raj.khem@gmail.com
State New
Headers show
Series [1/2] libclc: Fix absolute symlinks in sysroot | expand

Commit Message

Khem Raj July 30, 2025, 4:38 a.m. UTC
This helps in creating relative symlinks

Fixes sstate errors e.g.
ERROR: sstate found an absolute path symlink /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/sysroot-destdir/home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/recipe-sysroot-native/usr/share/clc/gfx90c-amdgcn-mesa-mesa3d.bc pointing at /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/build/tahiti-amdgcn-mesa-mesa3d.bc. Please replace this with a relative link.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/clang/libclc_git.bb | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Ross Burton Aug. 1, 2025, 2:37 p.m. UTC | #1
On 30 Jul 2025, at 05:38, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> 
> This helps in creating relative symlinks
> 
> Fixes sstate errors e.g.
> ERROR: sstate found an absolute path symlink /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/sysroot-destdir/home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/recipe-sysroot-native/usr/share/clc/gfx90c-amdgcn-mesa-mesa3d.bc pointing at /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/build/tahiti-amdgcn-mesa-mesa3d.bc. Please replace this with a relative link.

This seems unexpected.

$ pwd
/work/ross/build/tmp/work/aarch64-linux/libclc-native/20.1.8/sysroot-destdir/work/ross/build/tmp/work/aarch64-linux/libclc-native/20.1.8/recipe-sysroot-native/usr/share/clc

$ ls -l gfx90c-amdgcn-mesa-mesa3d.bc
lrwxrwxrwx 1 rosbur01 rosbur01 28 Aug  1 13:34 gfx90c-amdgcn-mesa-mesa3d.bc -> tahiti-amdgcn-mesa-mesa3d.bc

Any idea why you’re hitting this, but not the autobuilder or myself?

Ross
Ross Burton Aug. 1, 2025, 2:40 p.m. UTC | #2
On 1 Aug 2025, at 15:37, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> 
> On 30 Jul 2025, at 05:38, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
>> 
>> This helps in creating relative symlinks
>> 
>> Fixes sstate errors e.g.
>> ERROR: sstate found an absolute path symlink /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/sysroot-destdir/home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/recipe-sysroot-native/usr/share/clc/gfx90c-amdgcn-mesa-mesa3d.bc pointing at /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/build/tahiti-amdgcn-mesa-mesa3d.bc. Please replace this with a relative link.
> 
> This seems unexpected.

Oh, it’s because you’re testing a new llvm.

Backport abe93d9d7e891a2a6596ddb0c6324280137c89dc.

Ross
Khem Raj Aug. 1, 2025, 2:44 p.m. UTC | #3
On Fri, Aug 1, 2025 at 7:41 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 1 Aug 2025, at 15:37, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> >
> > On 30 Jul 2025, at 05:38, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >>
> >> This helps in creating relative symlinks
> >>
> >> Fixes sstate errors e.g.
> >> ERROR: sstate found an absolute path symlink /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/sysroot-destdir/home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/recipe-sysroot-native/usr/share/clc/gfx90c-amdgcn-mesa-mesa3d.bc pointing at /home/khem/yoe/build/tmp/work/aarch64-linux/libclc-native/21.1.0/build/tahiti-amdgcn-mesa-mesa3d.bc. Please replace this with a relative link.
> >
> > This seems unexpected.
>
> Oh, it’s because you’re testing a new llvm.

This is seen with upcoming clang-21, I do not remember seeing with clang-20

>
> Backport abe93d9d7e891a2a6596ddb0c6324280137c89dc.
>
> Ross
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/libclc_git.bb b/meta/recipes-devtools/clang/libclc_git.bb
index ed31de503ae..e508959791e 100644
--- a/meta/recipes-devtools/clang/libclc_git.bb
+++ b/meta/recipes-devtools/clang/libclc_git.bb
@@ -24,6 +24,21 @@  LIBCLC_TARGETS ?= "all"
 EXTRA_OECMAKE = "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS} \
                  -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
 
+do_install:append() {
+    # Convert absolute symlinks to relative ones (same directory)
+    cd ${D}
+    find . -type l | while read link; do
+        target=$(readlink "$link")
+        case "$target" in
+            /*)
+                # Extract filename and point to current directory
+                target_basename=$(basename "$target")
+                ln -sf "$target_basename" "$link"
+                ;;
+        esac
+    done
+}
+
 # Need to build a native prepare_builtins binary in target builds. The easiest
 # way to do this is with a second native cmake build tree.
 do_build_prepare_builtins() {