Closed sheltongeosx closed 4 years ago
We've not had much luck getting bazel working with J9. Are you able to try with Hotspot/OpenJDK?
I tried OpenJDK 14.0.1+7, got the following errors:
ERROR: /tmp/bazel_whaTXPzI/out/external/bazel_tools/tools/jdk/BUILD:492:1: Configurable attribute "actual" doesn't match this configuration: Could not find a JDK for host execution environment, please explicitly provide one using `--host_javabase.`
INFO: Repository remote_java_tools_linux instantiated at:
no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
/tmp/bazel_whaTXPzI/out/external/bazel_tools/tools/build_defs/repo/http.bzl:336:16: in <toplevel>
ERROR: Analysis of target '//src:bazel_nojdk' failed; build aborted:
You should do what it says and add a --host_javabase
parameter to let it know where your java. That should be appended to the bazel_build line in compile.sh.
@jayfurmanek, Thanks for your suggestions. It looks that ./compile.sh won't read --host_javabase wich I specified as "@local_jdk//:jdk" It still gave the same error. I wonder that there got to be something I am missing...
Take a look at: https://docs.bazel.build/versions/master/bazel-and-java.html#configuring-the-jdk
If using an external jdk, you have to specify more things. Something like this worked for me:
--define=ABSOLUTE_JAVABASE=/home/builder/bazel/jdk-11.0.2+9 \
--javabase=@bazel_tools//tools/jdk:absolute_javabase \
--host_javabase=@bazel_tools//tools/jdk:absolute_javabase \
--java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
--host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
Where ABSOLUTE_JAVABASE there points to an openjdk build I pulled down from adopt-openjdk.
If you are still stuck and you are using Ubuntu, you can find community builds linked from this page: https://docs.bazel.build/versions/master/install.html
In WML CE, we change the BUILD files in a few places so that when building bazel, it will pull down a JDK and embed it. There are a few more files to edit in that case.
@jayfurmanek, that help a lot! Now the error:
/tmp/bazel_48kR03VO/out/execroot/io_bazel/bazel-out/host/bin/external/com_google_protobuf/protoc: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found
My system has /lib64/libstdc++.so.6.0.19, but libstdc++ in my conda lib is 6.0.25 which defines GLIBCXX_3.4.20. Is there anyway to have it link to this libstdc++? LD_LIBRARY_PATH seems doesn't work. Thanks!
It's easier to build from the distribution rather than having to generate all the protobuf files yourself with protoc. Download the bazel-{version}-dist.zip
and go from there. No protoc needed. :)
Sorry - didn't mean to close this. Let me know if you still are stuck.
@jayfurmanek, Realized that the GLIBCXX symbol issue is because I am using gcc/7.3.0 by default which is newer then the host gcc. By using sytem gcc (4.8.5) bazel is successfully built. Hope that rpath could be specified in someway by user to link a newer libstdc++.
Thank you so much for your help!
HI, I am trying to build new version of Bazel (3.1.0, 3.0.0 or 2.2.0) with the java version:
When running "./compile.sh", all produced the same errors:
Any suggestion?
Thanks, Shelton