IBM / powerai

This repo contains ancillary information used to assist users of IBM Watson Machine Learning Community Edition. This repo will contain How To's, Readme's, Dockerfiles, etc. that can be consumed by users looking to get started.
BSD 2-Clause "Simplified" License
56 stars 54 forks source link

Bazel build error #253

Closed sheltongeosx closed 4 years ago

sheltongeosx commented 4 years ago

HI, I am trying to build new version of Bazel (3.1.0, 3.0.0 or 2.2.0) with the java version:

Java(TM) SE Runtime Environment (build 8.0.6.10 - pxl6480sr6fp10-20200408_01(SR6 FP10))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux ppc64le-64-Bit

When running "./compile.sh", all produced the same errors:

 java.lang.IllegalStateException: Can't find tenured space; update this class for a new collector
 ......

Any suggestion?

Thanks, Shelton

jayfurmanek commented 4 years ago

We've not had much luck getting bazel working with J9. Are you able to try with Hotspot/OpenJDK?

sheltongeosx commented 4 years ago

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: 
jayfurmanek commented 4 years ago

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.

sheltongeosx commented 4 years ago

@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...

jayfurmanek commented 4 years ago

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.

sheltongeosx commented 4 years ago

@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!

jayfurmanek commented 4 years ago

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. :)

jayfurmanek commented 4 years ago

Sorry - didn't mean to close this. Let me know if you still are stuck.

sheltongeosx commented 4 years ago

@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!