diff mbox series

[meta-tensorflow] bazel-native: Allow build from sstate-cache

Message ID 20230511085319.4147-1-tomasz.dziendzielski@gmail.com
State New
Headers show
Series [meta-tensorflow] bazel-native: Allow build from sstate-cache | expand

Commit Message

Tomasz Dziendzielski May 11, 2023, 8:53 a.m. UTC
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.

Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
---
 recipes-devtools/bazel/bazel-native_5.3.2.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jose Quaresma May 11, 2023, 9:11 a.m. UTC | #1
Hi Tomasz,

Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> escreveu no dia
quinta, 11/05/2023 à(s) 09:53:

> 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.
>
> Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
> ---
>  recipes-devtools/bazel/bazel-native_5.3.2.bb | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/recipes-devtools/bazel/bazel-native_5.3.2.bb
> b/recipes-devtools/bazel/bazel-native_5.3.2.bb
> index da13a53..c9e4343 100644
> --- a/recipes-devtools/bazel/bazel-native_5.3.2.bb
> +++ b/recipes-devtools/bazel/bazel-native_5.3.2.bb
> @@ -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


>      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
> --
> 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: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Tomasz Dziendzielski May 11, 2023, 9:18 a.m. UTC | #2
Hi Jose,
>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
Jose Quaresma May 11, 2023, 9:28 a.m. UTC | #3
Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> escreveu no dia
quinta, 11/05/2023 à(s) 10:15:

> Hi Jose,
> >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


> Best regards,
> Tomasz Dziendzielski
>
diff mbox series

Patch

diff --git a/recipes-devtools/bazel/bazel-native_5.3.2.bb b/recipes-devtools/bazel/bazel-native_5.3.2.bb
index da13a53..c9e4343 100644
--- a/recipes-devtools/bazel/bazel-native_5.3.2.bb
+++ b/recipes-devtools/bazel/bazel-native_5.3.2.bb
@@ -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