bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.15k stars 4.05k forks source link

Cannot build/bootstrap Bazel 5.3.0 from source in Raspberry Pi (Raspbian Buster) #16416

Closed febrifahmi closed 5 months ago

febrifahmi commented 2 years ago

Description of the bug:

I try to build Bazel 5.3.0 from source since Bazel on arm always failed to build tflite_support following the steps described in Bazel docs. However, it always killed in the process and it also took a long time to build (more than 5 hrs on my Raspberry Pi).

Here is the log:

Building Bazel from scratch../usr/lib/jvm/java-8-openjdk-armhf/bin/javac -classpath derived/jars/com_google_protobuf/java/core/liblite.jar:derived/jars/com_google_protobuf/java/core/libcore.jar:derived/jars/com_google_protobuf/java/util/libutil.jar:derived/jars/zstd-jni/libzstd-jni.jar:third_party/gson/gson-2.8.0.jar:third_party/xz/xz-1.9.jar:third_party/perfmark/perfmark-api-0.19.0.jar:third_party/jsr330_inject/javax.inject.jar:third_party/apache_commons_codec/commons-codec-1.10.jar:third_party/animal_sniffer/animal-sniffer-annotations-1.14.jar:third_party/apache_commons_logging/commons-logging-1.1.1.jar:third_party/truth8/truth-java8-extension-1.0.1.jar:third_party/asm/asm-commons-9.2-sources.jar:third_party/asm/asm-analysis-9.2.jar:third_party/asm/asm-9.2-sources.jar:third_party/asm/asm-util-9.2-sources.jar:third_party/asm/asm-tree-9.2-sources.jar:third_party/asm/asm-commons-9.2.jar:third_party/asm/asm-9.2.jar:third_party/asm/asm-util-9.2.jar:third_party/asm/asm-analysis-9.2-sources.jar:third_party/asm/asm-tree-9.2.jar:third_party/checker_framework_dataflow/dataflow-errorprone-3.15.0.jar:third_party/checker_framework_dataflow/dataflow-shaded-3.11.0-sources.jar:third_party/checker_framework_dataflow/dataflow-shaded-3.11.0.jar:third_party/checker_framework_dataflow/dataflow-errorprone-3.15.0-sources.jar:third_party/apache_commons_io/commons-io-2.4.jar:third_party/kotlin_stdlib/kotlin-stdlib-jdk7-1.3.21.jar:third_party/kotlin_stdlib/kotlin-stdlib-common-1.3.21.jar:third_party/kotlin_stdlib/kotlin-stdlib-1.3.21.jar:third_party/kotlin_stdlib/kotlin-stdlib-jdk8-1.3.21.jar:thir                                                                                                             d_party/checker_framework_javacutil/javacutil-3.2.0-sources.jar:third_party/checker_framework_javacutil/javacutil-3.2.0.jar:third_party/jsr305/jsr-305.jar:third_party/checker_framework_annotations/checker-qual-3.2.0-sources.jar:third_party/                                                                                                             checker_framework_annotations/checker-qual-3.2.0.jar:third_party/jimfs/jimfs-1.1.jar:third_party/jetifier/jetifier-core-1.0.0-beta04.jar:third_party/android_common/com.android.tools.build_manifest-merger_25.0.0-patched.jar:third_party/andro                                                                                                             id_common/com.android.tools.lint_lint-api_25.0.0.jar:third_party/android_common/com.android.tools.lint_lint-checks_25.0.0.jar:third_party/android_common/com.android.tools_sdk-common_25.0.0-patched-stripped.jar:third_party/android_common/com.android.tools.build_builder-test-api_2.0.0.jar:third_party/android_common/com.android.tools_sdk-common_25.0.0-patched.jar:third_party/android_common/com.android_annotations_25.0.0.jar:third_party/android_common/com.android.tools_repository_25.0.0.jar:third_party/android_common/com.android.tools_sdklib_25.0.0.jar:third                                                                                                             _party/android_common/com.android.tools.layoutlib_layoutlib_26.1.2-stripped.jar:third_party/android_common/com.android.tools_dvlib_25.0.0.jar:third_party/android_common/com.android.tools.build_builder-model_2.0.0.jar:third_party/android_common/com.android.tools.layoutlib_layoutlib_26.1.2.jar:third_party/android_common/com.android.tools.build_builder_2.0.0.jar:third_party/android_common/com.android.tools.external.lombok_lombok-ast_0.2.3.jar:third_party/android_common/com.android.tools_common_25.0.0.jar:third_party/apache_commons_pool2/commons-pool2-2.8.0.jar:third_party/api_client/google-api-client-gson-1.22.0.jar:third_party/api_client/google-api-client-1.22.0.jar:third_party/api_client/google-http-client-1.22.0-SNAPSHOT.jar:third_party/api_client/google-http-client-gson-1.22.0.jar:third_party/apache_velocity/velocity-1.7.jar:third_party/junit/junit-4.13.jar:third_party/java-diff-utils/java-diff-utils-4.0.jar:third_party/apache_commons_collections/commons-collections-3.2.2.jar:third_party/truth/truth-1.0.1.jar:third_party/rxjava3/rxjava-3.1.2.jar:third_party/antlr/antlr4-4.5.3.jar:third_party/javax_annotations/javax.annotation-api-1.3.2.jar:third_party/javax_annotations/javax.annotation-api-1.3.2-sources.jar:third_party/bazel_bootstrap/libserialization-constant-processor.jar:third_party/bazel_bootstrap/libserialization-processor-util.jar:third_party/bazel_bootstrap/libserialization.jar:third_party/bazel_bootstrap/lib                                                                                                             autocodec-processor.jar:third_party/bazel_bootstrap/libautocodec-annotation.jar:third_party/bazel_bootstrap/libregistered-singleton.jar:third_party/bazel_bootstrap/libserialization-constant-annotation.jar:third_party/bazel_bootstrap/libunsafe-provider.jar:third_party/compile_testing/compile-testing-0.18.jar:third_party/flogger/flogger-0.5.1.jar:third_party/flogger/google-extensions-0.5.1.jar:third_party/flogger/flogger-system-backend-0.5.1.jar:third_party/diffutils/diffutils-1.3.0.jar:third_party/caffeine/caffeine-2.9.2.jar:third_party/error_prone/threeten-extra-1.5.0.jar:third_party/error_prone/error_prone_annotations-2.9.0.jar:thi                                                                                                             rd_party/error_prone/error_prone_type_annotations-2.9.0.jar:third_party/error_prone/error_prone_annotation-2.9.0.jar:third_party/error_prone/error_prone_core-2.9.0.jar:third_party/error_prone/error_prone_check_api-2.9.0.jar:third_party/objenesis/objenesis-1_3.jar:third_party/auth/google-auth-library-oauth2-http-1.6.0.jar:third_party/auth/google-auth-library-credentials-1.6.0.jar:third_party/hamcrest/hamcrest-core-1.3.jar:third_party/javax_activation/javax.activation-api-1.2.0.jar:third_party/javax_activation/javax.activation-api-1.2.0-sources.jar:third_party/turbine/turbine_direct.jar:third_party/opencensus/opencensus-contrib-grpc-metrics-0.24.0.jar:third_party/opencensus/opencensus-api-0.24.0.jar:third_party/ijar/test/sealed/sealed.jar:third_party/ijar/test/records/records.jar:third_party/ijar/test/jar-with-manifest.jar:third_party/ijar/test/libwrongcentraldir.jar:third_party/ijar/test/jar-with-manifest-and-target-label.jar:third_party/ijar/test/jar-without-manifest.jar:third_party/ijar/test/nestmates/nestmates.jar:third_party/java/jacoco/org.jacoco.agent-0.8.7.jar:third_party/java/jacoco/org.jacoco.report-0.8.7-sources.jar:third_party/java/jacoco/org.jacoco.report-0.8.7.jar:third_party/java/jacoco/jacocoagent-0.8.7.jar:third_party/java/jacoco/org.jacoco.core-0.8.7-sources.jar:third_party/java/jacoco/org.jacoco.ant-0.8.7.jar:third_party/java/jacoco/org.jacoco.agent-0.8.7-sources.jar:third_party/java/jacoco/org.jacoco.ant-0.8.7-sources.jar:third_party/java/jacoco/org.jacoco.ant-0.8.7-nodeps.jar:third_party/java/jacoco/org.jacoco.core-0.8.7.jar:third_party/java/javapoet/javapoet-1.8.0.jar:third_party/java/jcommander/jcommander-1.48.jar:third_party/java/jdk/langtools/java_compiler.jar:third_party/java/jdk/langtools/jdk_compiler.jar:third_party/java/jdk/langtools/jdk_compiler-src.jar:third_party/java/jdk/langtools/java_compiler-src.jar:third_party/java/jdk/langtools/javac-9+181-r4173-1.jar:third_party/java/android_databinding/v3_4_0/x_common.jar:third_party/java/androi                                                                                                             d_databinding/v3_4_0/exec.jar:third_party/java/android_databinding/v3_4_0/compiler.jar:third_party/java/android_databinding/v3_4_0/compiler_common.jar:third_party/java/android_databinding/v3_4_0/base.jar:third_party/java/j2objc-annotations/j2objc-annotations-1.1.jar:third_party/java/proguard/proguard6.2.2/lib/proguardgui.jar:third_party/java/proguard/proguard6.2.2/lib/retrace.jar:third_party/java/proguard/proguard6.2.2/lib/proguard.jar:third_party/auto/auto-service-1.0-rc7.jar:third_party/auto/auto-value-1.8.2.jar:third_party/auto/auto-value-annotations-1.8.2.jar:third_party/auto/auto-common-1.1.2.jar:third_party/auto/auto-service-annotations-1.0-rc7.jar:third_party/guava/failureaccess-1.0.1.jar:third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar:third_party/truth_proto/truth-proto-extension-1.0.1.jar:third_party/truth_proto/truth-liteproto-extension-1.0.1.jar:third_party/juniversalchardet/juniversalchardet-1.0.3.jar:third_party/netty/netty-transport-native-unix-common-4.1.69.Final-linux-aarch_64.jar:third_party/netty/netty-codec-4.1.69.Final.jar:third_party/netty/netty-transport-native-kqueue-4.1.69.Final-osx-aarch_64.jar:third_party/netty/netty-transport-native-epoll-4.1.69.Final-linux-x86_64.jar:third_party/netty/netty-common-4.1.69.Final.jar:third_party/netty/netty-resolver-dns-4.1.69.Final.jar:third_party/netty/netty-resolver-4.1.69.Final.jar:third_party/netty/netty-handler-4.1.69.Final.jar:third_party/netty/netty-codec-http-4.1.69.Final.jar:third_party/netty/netty-transport-native-epoll-4.1.69.Final.jar:third_party/netty/netty-transport-4.1.69.Final.jar:third_party/netty/netty-codec-http2-4.1.69.Final.jar:third_party/netty/netty-transport-sctp-4.1.69.Final.jar:third_party/netty/netty-transport-native-unix-common-4.1.69.Final-osx-x86_64.jar:third_party/netty/netty-buffer-4.1.69.Final.jar:third_party/netty/netty-transport-native-unix-common-4.1.69.Final-linux-x86_64.jar:third_party/netty/netty-handler-proxy-4.1.69.Final.jar:third_party/netty/netty-transport-native-unix-common-4.1.69.Final-osx-aarch_64.jar:third_party/netty/netty-transport-native-kqueue-4.1.69.Final.jar:third_party/netty/netty-transport-native-epoll-4.1.69.Final-linux-aarch_64.jar:third_party/netty/netty-transport-native-unix-common-4.1.69.Final.jar:third_party/netty/netty-transport-native-kqueue-4.1.69.Final-osx-x86_64.jar:third_party/bytebuddy/byte-buddy-1.9.7.jar:third_party/bytebuddy/byte-buddy-agent-1.9.7.jar:third_party/tomcat_annotations_api/tomcat-annotations-api-8.0.5.jar:third_party/reactive_streams/reactive-streams-1.0.3.jar:third_party/jcip_annotations/jcip-annotations-1.0-1.jar:third_party/pcollections/pcollections-2.1.2.jar:third_party/hungarian_algorithm/software-and-algorithms-1.0-src.jar:third_party/hungarian_algorithm/software-and-algorithms-1.0.jar:third_party/apache_commons_lang/commons-lang-2.6.jar:third_party/jetbrains_annotations/annotations-13.0.jar:third_party/apache_commons_compress/apache-commons-compress-1.19.jar:third_party/jaxb/2.3.0/jaxb-api-2.3.0.jar:third_party/jaxb/2.3.0/jaxb-core-2.3.0.jar:third_party/jaxb/2.3.0/jaxb-impl-2.3.0.jar:third_party/jaxb/2.3.0/jaxb-impl-2.3.0-sources.jar:third_party/jaxb/2.3.0/jaxb-api-2.3.0-sources.jar:third_party/jaxb/2.3.0/jaxb-core-2.3.0-sources.jar:third_party/jaxb/jaxb-api-2.3.1-sources.jar:third_party/jaxb/jaxb-api-2.3.1.jar:third_party/jaxb/jaxb-api-2.3.1-patched.jar:third_party/mockito/mockito-core-3.12.4.jar::third_party/grpc/grpc-context-1.41.0.jar:third_party/grpc/grpc-core-1.41.0.jar:third_party/grpc/grpc-protobuf-1.41.0.jar:third_party/grpc/grpc-auth-1.41.0.jar:third_party/grpc/grpc-api-1.41.0.jar:third_party/grpc/grpc-stub-1.41.0.jar:third_party/grpc/grpc-netty-1.41.0.jar:third_party/grpc/grpc-protobuf-lite-1.41.0.jar::third_party/guava/guava-testlib-30.1.1-jre.jar:third_party/guava/guava-30.1.1-jre.jar::/tmp/bazel_cezjTuBS -sourcepath src/java_tools/singlejar/java/com/google/devtools/build/zip:src/main/java:tools/java/runfiles:/tmp/bazel_cezjTuBS/src -d /tmp/bazel_cezjTuBS/classes -source 1.8 -target 1.8 -encoding UTF-8 -g -J-Xms384m -J-Xmx800m @/tmp/bazel_Ogdq12A0/param
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler                                                                                                             .java:17: warning: Signal is internal proprietary API and may be removed in a fu                                                                                                             ture release
import sun.misc.Signal;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler                                                                                                             .java:18: warning: SignalHandler is internal proprietary API and may be removed                                                                                                              in a future release
import sun.misc.SignalHandler;
               ^
src/main/java/com/google/devtools/build/lib/skyframe/serialization/DynamicCodec.                                                                                                             java:30: warning: ReflectionFactory is internal proprietary API and may be remov                                                                                                             ed in a future release
import sun.reflect.ReflectionFactory;
                  ^
src/main/java/com/google/devtools/build/lib/skyframe/serialization/EnumMapCodec.                                                                                                             java:23: warning: Unsafe is internal proprietary API and may be removed in a fut                                                                                                             ure release
import sun.misc.Unsafe;
               ^
src/main/java/com/google/devtools/build/lib/unsafe/StringUnsafe.java:21: warning                                                                                                             : Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;
               ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:21: warni                                                                                                             ng: Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;
               ^
scripts/bootstrap/buildenv.sh: line 201: 26563 Killed                  "${@}"

here is line 201 in buildenv.sh :

# Excutes a command respecting the current verbosity settings.
#
# If VERBOSE is yes, the command itself and its output are printed.
# If VERBOSE is no, the command's output is only displayed in case of failure.
#
# Exits the script if the command fails.
function run() {
  if [ "${VERBOSE}" = yes ]; then
    echo "${@}"
    "${@}" || exit $?
  else
    local errfile="${OUTPUT_DIR}/errors"

    echo "${@}" >"${errfile}"
    if ! "${@}" >>"${errfile}" 2>&1; then
      local exitcode=$?
      cat "${errfile}" 1>&2
      exit $exitcode
    fi
  fi
}

function display() {
  if [[ -z "${QUIETMODE}" ]]; then
    echo -e "$@" >&2
  fi
}

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Download unzip Bazel 5.3.0 dist release and run:

pi@raspberrypi:~ $ nohup env BAZEL_JAVAC_OPTS="-g -J-Xms384m -J-Xmx800m" JAVA_TOOL_OPTS="-Xmx800m" EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh

Which operating system are you running Bazel on?

I try to bootstrap on Raspbian Buster

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

Not really

Any other information, logs, or outputs that you want to share?

No response

sgowroji commented 2 years ago

Hello @febrifahmi, Have you tried the steps from here. Thanks!

febrifahmi commented 2 years ago

Yes, I already install Bazel on arm before on my pi. Bazel on arm installed successfully and can run, but it failed when build tflite-support ~ see this issue here.

meteorcloudy commented 2 years ago

It looks like you are building with JDK8, which we no longer support, can you please upgrade the JDK version and try again?

febrifahmi commented 2 years ago

Building Bazel from scratch using JDK11 failed with more or less same error:

src/main/java/com/google/devtools/build/lib/skyframe/serialization/DynamicCodec.java:276: warning: ReflectionFactory is internal proprietary API and may be removed in a future release
        ReflectionFactory.getReflectionFactory()
        ^
src/main/java/com/google/devtools/build/lib/skyframe/serialization/EnumMapCodec.java:59: warning: Unsafe is internal proprietary API and may be removed in a future release
      Unsafe unsafe = UnsafeProvider.getInstance();
      ^
src/main/java/com/google/devtools/build/lib/unsafe/StringUnsafe.java:38: warning: Unsafe is internal proprietary API and may be removed in a future release
  private final Unsafe unsafe;
                ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:31: warning: Unsafe is internal proprietary API and may be removed in a future release
  private static final Unsafe UNSAFE = getUnsafe();
                       ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:33: warning: Unsafe is internal proprietary API and may be removed in a future release
  public static Unsafe getInstance() {
                ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:43: warning: Unsafe is internal proprietary API and may be removed in a future release
  private static Unsafe getUnsafe() {
                 ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:48: warning: Unsafe is internal proprietary API and may be removed in a future release
          new PrivilegedExceptionAction<Unsafe>() {
                                        ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:50: warning: Unsafe is internal proprietary API and may be removed in a future release
            public Unsafe run() throws Exception {
                   ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:51: warning: Unsafe is internal proprietary API and may be removed in a future release
              Class<Unsafe> unsafeClass = Unsafe.class;
                    ^
src/main/java/com/google/devtools/build/lib/unsafe/UnsafeProvider.java:51: warning: Unsafe is internal proprietary API and may be removed in a future release
              Class<Unsafe> unsafeClass = Unsafe.class;
                                          ^
scripts/bootstrap/buildenv.sh: line 201:  1047 Killed                  "${@}"
meteorcloudy commented 2 years ago

@febrifahmi Can you just download the Linux arm64 binary from https://github.com/bazelbuild/bazel/releases/tag/5.3.1? I don't think bootstrapping Bazel will make a different for the tflite build. We also never tested bootstrapping on the specific platform.

febrifahmi commented 2 years ago

Unfortunately, I don't think that binary could run in my old pi (armv6l Raspberry Pi model B rev 002).

github-actions[bot] commented 8 months ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

github-actions[bot] commented 5 months ago

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!