Skip to contentSkip to conversation

bazel-native: Allow build from sstate-cache

PATCH Superseded Tomasz Dziendzielski 2 participants 4 messages May 11, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bazel-native: Allow build from sstate-cache

Using TOPDIR variable breaks the sstate-cache every time build directory changes totally breaking build from sstate-cache among different workspaces.

Changing that to TMPDIR that is included in BB_HASHEXCLUDE_COMMON.

Another thing is disabling the UNINATIVE_LOADER, causing sstate-cache artifacts not working in different workspaces. On populate_sysroot_setscene patchelf-uninative --set-interpreter with empty argument is ran which does not change the interpreter path and then bazel binary ends up with path to the interpreter that might not exist, since the bazel was taken from sstate-cache.

Removing the UNINATIVE_LOADER = "" so that uninative.bbclass can correctly replace the interpreter path and make bazel binary usable. One could think that it will reintroduce the original issue behind disabling uninative, which was some java file corrupted (see commit dd7642b), but I think we don't have this problem anymore and also I don't think it was the correct solution - since the loader is anyway included in the binary, so it wasn't really disabling it, just disabling the yocto functionality around uninative. If the error re-occurs I think different solution should be found.

---
 recipes-devtools/bazel/bazel-native_5.3.2.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
recipes-devtools/bazel/bazel-native_5.3.2.bb +1 -4
index da13a53..c9e4343 100644
@@ -38,7 +38,7 @@ EXTRA_BAZEL_ARGS = " \
 
 do_compile[network] = "1"
 do_compile () {
-    TMPDIR="${TOPDIR}/bazel" \
+    TMPDIR="${TMPDIR}/../bazel" \
     VERBOSE=yes \
     EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS}" \
     ./compile.sh
@@ -49,7 +49,4 @@ do_install () {
     install -m 0755 ${S}/output/bazel ${D}${bindir}
 }
 
-# Explicitly disable uninative
-UNINATIVE_LOADER = ""
-
 inherit native
Signature · 1 line
2.40.1
#1 lore raw

Hi Tomasz,

Tomasz Dziendzielski <[email protected]> escreveu no dia quinta, 11/05/2023 à(s) 09:53:

Quoted 34 lines

Using TOPDIR variable breaks the sstate-cache every time build directory changes totally breaking build from sstate-cache among different workspaces.

Changing that to TMPDIR that is included in BB_HASHEXCLUDE_COMMON.

Another thing is disabling the UNINATIVE_LOADER, causing sstate-cache artifacts not working in different workspaces. On populate_sysroot_setscene patchelf-uninative --set-interpreter with empty argument is ran which does not change the interpreter path and then bazel binary ends up with path to the interpreter that might not exist, since the bazel was taken from sstate-cache.

Removing the UNINATIVE_LOADER = "" so that uninative.bbclass can correctly replace the interpreter path and make bazel binary usable. One could think that it will reintroduce the original issue behind disabling uninative, which was some java file corrupted (see commit dd7642b), but I think we don't have this problem anymore and also I don't think it was the correct solution - since the loader is anyway included in the binary, so it wasn't really disabling it, just disabling the yocto functionality around uninative. If the error re-occurs I think different solution should be found.

---
 recipes-devtools/bazel/bazel-native_5.3.2.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
recipes-devtools/bazel/bazel-native_5.3.2.bb +0 -0
index da13a53..c9e4343 100644

recipes-devtools/bazel/bazel-native_5.3.2.bb EXTRA_BAZEL_ARGS = " \ · line 42

Quoted 6 lines
recipes-devtools/bazel/bazel-native_5.3.2.bb +1 -1
@@ -38,7 +38,7 @@ EXTRA_BAZEL_ARGS = " \
 
 do_compile[network] = "1"
 do_compile () {
-    TMPDIR="${TOPDIR}/bazel" \
+    TMPDIR="${TMPDIR}/../bazel" \
 

Why not use the something inside the bitbake TMPDIR, if it is temporary the correct place will be in TMPDIR.

so TMPDIR="${TMPDIR}/bazel" looks better IMO.

Jose

Quoted 26 lines
recipes-devtools/bazel/bazel-native_5.3.2.bb +0 -0
     VERBOSE=yes \
     EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS}" \

./compile.sh

recipes-devtools/bazel/bazel-native_5.3.2.bb +0 -4
@@ -49,7 +49,4 @@ do_install () {
     install -m 0755 ${S}/output/bazel ${D}${bindir}
 }
 
-# Explicitly disable uninative
-UNINATIVE_LOADER = ""
-
 inherit native
--

2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#59981):
https://lists.yoctoproject.org/g/yocto/message/59981
Mute This Topic: https://lists.yoctoproject.org/mt/98823739/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma
#2 lore raw

Hi Jose,

Quoted 1 line

Why not use the something inside the bitbake TMPDIR, if it is temporary

the correct place will be in TMPDIR.
I wanted to keep the same directory as it was before, but you're right TMPDIR/bazel will be better place. I'll send second patch.

Best regards,
Tomasz Dziendzielski

#3 lore raw

Tomasz Dziendzielski <[email protected]> escreveu no dia quinta, 11/05/2023 à(s) 10:15:

Quoted 6 lines

Hi Jose,

Quoted 1 line

Why not use the something inside the bitbake TMPDIR, if it is temporary

the correct place will be in TMPDIR.
I wanted to keep the same directory as it was before, but you're right TMPDIR/bazel will be better place. I'll send second patch.

The default bibtake config is TMPDIR ?= "${TOPDIR}/tmp" so in this case it will be the same directory
but note that this is not always true and the TMPDIR can be changed in some distros configs, in this cases it will be stored somewhere else.

Jose

Quoted 3 lines

Best regards,
Tomasz Dziendzielski

Signature · 3 lines
Best regards,

José Quaresma