Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv64 : Error building bazel from scratch #19331

Closed
CoolKingYY opened this issue Aug 25, 2023 · 7 comments
Closed

riscv64 : Error building bazel from scratch #19331

CoolKingYY opened this issue Aug 25, 2023 · 7 comments
Labels

Comments

@CoolKingYY
Copy link

CoolKingYY commented Aug 25, 2023

Description of the bug:

[fedora@fedora-riscv bazel]$ env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh

ERROR: /home/fedora/bazel/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/BUILD:169:23: JavacBootstrap src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar [for tool] failed: (Exit 1): bash failed: error executing command (from target //src/java_tools/buildjar/java/com/google/devtools/build/buildjar:starlark-deps) (cd /tmp/bazel_OY7GtMvI/out/execroot/io_bazel && \
........
# Execution platform: //:default_host_platform
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.base/java.util.HashMap.resize(HashMap.java:699) at java.base/java.util.HashMap.putVal(HashMap.java:624) at java.base/java.util.HashMap.put(HashMap.java:607) at java.base/java.util.ListResourceBundle.loadLookup(ListResourceBundle.java:204) at java.base/java.util.ListResourceBundle.handleGetObject(ListResourceBundle.java:130) at java.base/java.util.ResourceBundle.getObject(ResourceBundle.java:555) at java.base/java.util.ResourceBundle.getString(ResourceBundle.java:521) at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:220) at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:166) at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:155) at jdk.compiler/com.sun.tools.javac.util.Log.localize(Log.java:810) at jdk.compiler/com.sun.tools.javac.util.Log.printLines(Log.java:608) at jdk.compiler/com.sun.tools.javac.main.Main.resourceMessage(Main.java:414) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:326) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170) at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57) at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43) Target //src:bazel_nojdk failed to build INFO: Elapsed time: 4221.755s, Critical Path: 1440.35s INFO: 1902 processes: 330 internal, 1572 local. FAILED: Build did NOT complete successfully ERROR: Could not build

Which category does this issue belong to?

C++/Objective-C Rules

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

sudo dnf install gcc java-11-openjdk zip unzip python3
cd ~/bazel
export BAZEL_JAVAC_OPTS="-J-Xmx20g"
env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh -j32

Which operating system are you running Bazel on?

Linux fedora-riscv 6.1.42 #1 SMP Fri Aug 18 02:30:30 CST 2023 riscv64 GNU/Linux

What is the output of bazel info release?

bazel-6.3.2-dist

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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

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

Two steps:
The first step "Building Bazel from scratch" spends me much time.

@Pavank1992
Copy link
Contributor

@CoolKingYY, Could you please provide complete steps to reproduce this issue?

@CoolKingYY
Copy link
Author

@CoolKingYY,您能否提供重现此问题的完整步骤?

I've updated the question, do you need any other info?

@iancha1992
Copy link
Member

@CoolKingYY do you have a repo that you can share so that we can reproduce the errors that you're seeing?

@CoolKingYY
Copy link
Author

CoolKingYY commented Aug 29, 2023

@CoolKingYY您是否有可以分享的存储库,以便我们可以重现您所看到的错误?

Now, an error is reported as follows:

ERROR: /home/fedora/bazel/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/BUILD:169:23: 
JavacBootstrap src/java_tools/buildjar/java/com/gle/devtools/build/buildjar/libstarlark-deps.jar [for tool] failed: (Exit 1): 
bash failed: error executing command (from target //src/java_tools/buildjaava/com/google/devtools/build/buildjar:starlark-deps)

(cd /tmp/bazel_0xQdH7bw/out/execroot/io_bazel && \ exec env - \ PATH=/bin:/home/fedora/.local/bin:/home/fedora/bin:/bin:/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/varb/snapd/snap/bin \ /bin/bash -c 'set -e;rm -rf bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jbuild_output bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_java bazout/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_java_list mkdir bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_output bazel-ouiscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_java external/local_jdk/bin/javac -classpath '\''third_party/auto/auto-value-1.8.2.jar:third_party/auto/auto-value-annotations-1.8.2.jar:derived/jars/com_goe_protobuf/java/core/libcore.jar:derived/jars/com_google_protobuf/java/core/liblite.jar:derived/jars/com_google_protobuf/java/util/libutil.jar:derived/j/zstd-jni/libzstd-jni.jar:third_party/error_prone/error_prone_annotations-2.20.0.jar:third_party/error_prone/threeten-extra-1.5.0.jar:third_party/guava/va-31.1-jre.jar:third_party/jcip_annotations/jcip-annotations-1.0-1.jar:third_party/jsr305/jsr-305.jar:third_party/java/jacoco/org.jacoco.core-0.8.7.jarird_party/grpc-java/grpc-api-1.45.1.jar:third_party/grpc-java/grpc-api-1.47.0.jar:third_party/grpc-java/grpc-auth-1.45.1.jar:third_party/grpc-java/grpc-h-1.47.0.jar:third_party/grpc-java/grpc-context-1.45.1.jar:third_party/grpc-java/grpc-context-1.47.0.jar:third_party/grpc-java/grpc-core-1.45.1.jar:thirarty/grpc-java/grpc-core-1.47.0.jar:third_party/grpc-java/grpc-netty-1.45.1.jar:third_party/grpc-java/grpc-netty-1.47.0.jar:third_party/grpc-java/grpc-pobuf-1.45.1.jar:third_party/grpc-java/grpc-protobuf-1.47.0.jar:third_party/grpc-java/grpc-protobuf-lite-1.45.1.jar:third_party/grpc-java/grpc-protobuf-l-1.47.0.jar:third_party/grpc-java/grpc-stub-1.45.1.jar:third_party/grpc-java/grpc-stub-1.47.0.jar:third_party/tomcat_annotations_api/tomcat-annotations--8.0.5.jar'\'' -d bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_out @bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar-2.params external/local_jdk/bin/jar cf bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.j-C bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_output . touch bazel-out/riscv64-opt-exec-EDC14992/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libstarlark-deps.jar.build_output ')
# Configuration: fa0af6636a47b9bd34c9376022c62e6bb7a91b65435b12dc1052c57bbe67ab9a
# Execution platform: //:default_host_platform

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.HashMap.resize(HashMap.java:699)
        at java.base/java.util.HashMap.putVal(HashMap.java:624)
        at java.base/java.util.HashMap.put(HashMap.java:607)
        at java.base/java.util.ListResourceBundle.loadLookup(ListResourceBundle.java:204)
        at java.base/java.util.ListResourceBundle.handleGetObject(ListResourceBundle.java:130)
        at java.base/java.util.ResourceBundle.getObject(ResourceBundle.java:555)
        at java.base/java.util.ResourceBundle.getString(ResourceBundle.java:521)
        at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:220)
        at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:166)
        at jdk.compiler/com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:155)
        at jdk.compiler/com.sun.tools.javac.util.Log.localize(Log.java:810)
        at jdk.compiler/com.sun.tools.javac.util.Log.printLines(Log.java:608)
        at jdk.compiler/com.sun.tools.javac.main.Main.resourceMessage(Main.java:414)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:326)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

Target //src:bazel_nojdk failed to build INFO: Elapsed time: 4170.143s, Critical Path: 1455.85s INFO: 1902 processes: 330 internal, 1572 local. FAILED: Build did NOT complete successfully

[fedora@fedora-riscv bazel]$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
OpenJDK 64-Bit Zero VM 18.9 (build 11.0.11+9, interpreted mode)_

[fedora@fedora-riscv bazel-6.3.0]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-redhat-linux/12/lto-wrapper Target: riscv64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable_-___cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-12.2.1-20221121/obj-riscv64-redhat-linux/isl-install --enable-gnu-indirect-function --with-arch=rv64gc --with-abi=lp64d --with-multilib-list=lp64d --build=riscv64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC)_

@CoolKingYY
Copy link
Author

@CoolKingYY do you have a repo that you can share so that we can reproduce the errors that you're seeing?

Hi, the reason for the first problem is that I didn't handle the soft links for gcc12 as well as for java-11-openjdk.

@CoolKingYY
Copy link
Author

Thanks to the help of bazel techs, this issue has been resolved and closed.

@pourpourr
Copy link

Hi can you explain further what you did and you fixxed it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants