Skip to contentSkip to conversation

libclc: Fix absolute symlinks in sysroot

PATCH In review Khem Raj 2 participants 5 messages Jul 30, 2025 – Aug 1, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 libclc: Fix absolute symlinks in sysroot

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.

---
 meta/recipes-devtools/clang/libclc_git.bb | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
meta/recipes-devtools/clang/libclc_git.bb +15 -0
index ed31de503ae..e508959791e 100644
@@ -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() {
author
#1 lore raw

PATCH 2/2 libclc: Point to native prepare_builtins binary for target and nativesdk

This is not needed for native version

This will be in utils/ directory starting with clang-22

---
 meta/recipes-devtools/clang/libclc_git.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-devtools/clang/libclc_git.bb +3 -2
index e508959791e..7e63ce9c759 100644
@@ -21,8 +21,9 @@ B_NATIVE = "${B}-native"
 # Semicolon-separated list of targets to build
 LIBCLC_TARGETS ?= "all"
 
-EXTRA_OECMAKE = "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS} \
-                 -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
+EXTRA_OECMAKE = "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS}"
+EXTRA_OECMAKE:append:class-target = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
+EXTRA_OECMAKE:append:class-nativesdk = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
 
 do_install:append() {
     # Convert absolute symlinks to relative ones (same directory)
#2 lore raw
In reply to Khem Raj
Quoted 5 lines · Khem Raj via lists.openembedded.org

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

#3 lore raw
Quoted 9 lines · Ross Burton via lists.openembedded.org
Quoted 5 lines · Khem Raj via lists.openembedded.org

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

author
#4 lore raw
Quoted 5 lines · Ross Burton
Quoted 3 lines · Ross Burton via lists.openembedded.org
Quoted 1 line · Khem Raj via lists.openembedded.org
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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

Quoted 4 lines

Backport abe93d9d7e891a2a6596ddb0c6324280137c89dc.

Ross