bazel.bbclass: Fix build with bazel from sstate-cache
PATCH 1/1 bazel.bbclass: Fix build with bazel from sstate-cache
Random errors can occur when bazel is taken from sstate-cache and the dynamic loader is no longer available. Setting DYNAMIC_LOADER and letting populate_sysroot_setscene modify the UNINATIVE_LOADER is not enough. That way we just modify the loader of bazel binary, but bazel is also a self-extracting zip file with built-in binaries that need dynamic loader modification to work.
Eample error, as you can see it's quite misleading:
| An error occurred during the fetch of repository 'local_config_cuda' | Cuda Configuration Error: Invalid cpu_value | Skipping 'tensorflow/lite/tools/benchmark:benchmark_model': no such package '@local_config_cuda//cuda
To fix this in do_configure execute bazel version to unpack output_user_root and run patchelf-uninative on the ELF executables. Then change modification time to some future date so that bazel does not see the modification.
--- classes/bazel.bbclass | 12 ++++++++++++ 1 file changed, 12 insertions(+)
classes/bazel.bbclass +12 -0
@@ -129,6 +129,18 @@ build --linkopt=-Wl,-latomic EOF sed -i "s:${WORKDIR}:${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler:g" ${S}/bazelrc + + # Unzip bazel packages + ${BAZEL} ${BAZEL_STARTUP_OPTIONS} version + + for binary in build-runfiles daemonize linux-sandbox process-wrapper; do + # Modify interpreter for bazel built-in binaries + patchelf-uninative --set-interpreter "${UNINATIVE_LOADER}" ${BAZEL_DIR}/user_root/install/*/$binary + + # Set modification time somewhere in the future to avoid "corrupt installation: file PATH is missing or modified" + # in this case modification is required for successful build + touch -m -t 203712120101 ${BAZEL_DIR}/user_root/install/*/$binary + done } EXPORT_FUNCTIONS do_configure
Signature · 1 line
2.40.1
Hi Hongxu,
I can see you disabled the uninative back in the bazel-native recipe. Can you please provide steps to reproduce the "bazel/bazel.real: Input/output error" so we could investigate why it happens? Disabling uninative will cause the failure if bazel is taken from sstate-cache.
Best regards,
Tomasz Dziendzielski
Quoted 6 lines · Tomasz Dziendzielski
**
*CAUTION: This email comes from a non Wind River email account!*
Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hi Hongxu,
I can see you disabled the uninative back in the bazel-native recipe. Can you please provide steps to reproduce the "bazel/bazel.real: Input/output error" so we could investigate why it happens? Disabling uninative will cause the failure if bazel is taken from sstate-cache.
It is not reproducible always, but be reproducible on specific build host, it seems gcc tool chain or libc related I guess
//Hongxu
Quoted 2 lines
Best regards,
Tomasz Dziendzielski