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

Having trouble compiling bazel from source locally on Redhat #1122

Closed
jinhoonbang opened this issue Apr 5, 2016 · 30 comments
Closed

Having trouble compiling bazel from source locally on Redhat #1122

jinhoonbang opened this issue Apr 5, 2016 · 30 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug

Comments

@jinhoonbang
Copy link

I am trying to compile bazel from source (in order to tryout tensorflow) on a cluster. I don't have root rights, so I'm trying to compile it locally. I've read from other issues that compiling bazel from source locally isn't supported so I modified the crossfile a bit. I cloned bazel from the master branch. I'm using Red Hat 6.7.

Some information about the system:

$uname -a
Linux $CLUTERNAME 2.6.32-573.18.1.el6.x86_64 #1 SMP Wed Jan 6 11:20:49 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

gcc and java are installed locally as well.
$which gcc
~/jbang/gcc-4.8.5/bin/gcc

$which java
~/jbang/jdk1.8.0_73/bin/java

I've made some modifications to the CROSSTOOL:

  1. tool_path { name: "gcc" path: "~/jbang/gcc-4.8.5/bin/gcc" }
  2. added linker_flag: "-Wl,-R/lustre/home/dkl524/jbang/gcc-4.8.5/lib64"

When I run compile.sh, I get the following error:

INFO: Found 1 target...
ERROR: /home/dkl524/jbang/bazel/src/main/tools/BUILD:3:1: C++ compilation of rule '//src/main/tools:network-tools' failed: gcc failed: error executing command
(cd /tmp/bazel.b560SISc/out/bazel &&
exec env -
PATH=/home/dkl524/jbang/Python-2.7.11:/home/dkl524/jbang/jdk1.8.0_73/bin:/home/dkl524/jbang/gcc-4.8.5/bin:/opt/intel/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
'external/bazel_tools/tools/cpp//jbang/gcc-4.8.5/bin/gcc' -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -iquote . -iquote bazel-out/local_linux-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local_linux-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 '-std=c99' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/network-tools/src/main/tools/network-tools.pic.o' -MD -MF bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/network-tools/src/main/tools/network-tools.pic.d -fPIC -c src/main/tools/network-tools.c -o bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/network-tools/src/main/tools/network-tools.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127.
/tmp/bazel.b560SISc/out/bazel/_bin/process-wrapper: line 12: external/bazel_tools/tools/cpp/
/jbang/gcc-4.8.5/bin/gcc: No such file or directory
Target //src:bazel failed to build
ERROR: /home/dkl524/jbang/bazel/src/BUILD:125:2 C++ compilation of rule '//src/main/tools:namespace-sandbox' failed: gcc failed: error executing command
(cd /tmp/bazel.b560SISc/out/bazel &&
exec env -
PATH=/home/dkl524/jbang/Python-2.7.11:/home/dkl524/jbang/jdk1.8.0_73/bin:/home/dkl524/jbang/gcc-4.8.5/bin:/opt/intel/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
'external/bazel_tools/tools/cpp/~/jbang/gcc-4.8.5/bin/gcc' -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -iquote . -iquote bazel-out/local_linux-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local_linux-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 '-std=c99' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/namespace-sandbox/src/main/tools/namespace-sandbox.pic.o' -MD -MF bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/namespace-sandbox/src/main/tools/namespace-sandbox.pic.d -fPIC -c src/main/tools/namespace-sandbox.c -o bazel-out/local_linux-fastbuild/bin/src/main/tools/_objs/namespace-sandbox/src/main/tools/namespace-sandbox.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127.
INFO: Elapsed time: 4.254s, Critical Path: 1.24s

I'm assuming the error has to do with the way I've changed the crossfile. Bazel is clearly searching for a wrong directory.

@kchodorow
Copy link
Contributor

Can you try spelling out the full path to gcc (not using ~)? See the error:

external/bazel_tools/tools/cpp/~/jbang/gcc-4.8.5/bin/gcc: No such file or directory

@jinhoonbang
Copy link
Author

@kchodorow This is the full path: /home/dkl524/jbang/gcc-4.8.5

I'm not sure if the following info would help but here it is!
ls /tmp/bazel.b560SISc/out/bazel/external/bazel_tools/tools/cpp
BUILD cc_configure.bzl CROSSTOOL.tpl osx_cc_wrapper.sh.tpl
BUILD.tpl CROSSTOOL osx_cc_wrapper.sh test

@kchodorow
Copy link
Contributor

I mean: use the full path in the CROSSTOOL file's tool path that you customized. The CROSSTOOL isn't going to resolve ~.

@jinhoonbang
Copy link
Author

@kchodorow Replacing ~ with full path worked! However, it led me to anther error .

ERROR: /home/dkl524/jbang/bazel/src/main/cpp/util/BUILD:4:1: undeclared inclusion(s) in rule '//src/main/cpp/util:util':
this rule is missing dependency declarations for the following files included by 'src/main/cpp/util/port.cc':
'/home/dkl524/jbang/gcc-4.8.5/lib/gcc/x86_64-unknown-linux-gnu/4.8.5/include/stddef.h'
'/home/dkl524/jbang/gcc-4.8.5/include/getopt.h'.
Target //src:bazel failed to build

I checked that I have both '/home/dkl524/jbang/gcc-4.8.5/lib/gcc/x86_64-unknown-linux-gnu/4.8.5/include/stddef.h' and '/home/dkl524/jbang/gcc-4.8.5/include/getopt.h'.

@kchodorow
Copy link
Contributor

Generally this means that you have system includes in non-standard locations, so you'll need to add /home/dkl524/jbang/gcc-4.8.5/ as a cxx_builtin_include_directory in your CROSSTOOL.

@jinhoonbang
Copy link
Author

@kchodorow Thanks. That helped me get passed the error, but of course a new one. This one, I really can't seem to figure it out.

ERROR: /home/dkl524/jbang/bazel/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/BUILD:107:1: error executing shell command: 'set -e;rm -rf bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output bazel-out/host/bin/src/java_tools/build...' failed: bash failed: error executing command
(cd /tmp/bazel.DxRnfULT/out/bazel &&
exec env -
PATH=/home/dkl524/jbang/Python-2.7.11:/home/dkl524/jbang/jdk1.8.0_73/bin:/home/dkl524/jbang/gcc-4.8.5/bin:/opt/intel/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
/bin/bash -c 'set -e;rm -rf bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_java bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_java_list
mkdir bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_java
external/local_jdk/bin/javac -source 1.8 -target 1.8 -d bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output @bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar-2.params
external/local_jdk/bin/jar cf bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar -C bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output .
touch bazel-out/host/bin/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_invalid_command_line_exception.jar.build_output
'): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread
Target //src:bazel failed to build
INFO: Elapsed time: 10.674s, Critical Path: 6.47s

@jinhoonbang
Copy link
Author

What may be causing this error? I've been having no luck at all.

@kchodorow
Copy link
Contributor

This means that the JVM running Bazel is running out of memory. A couple things you could try:

  • If your machine just doesn't have much memory, try run with --jobs=8 (bazel build --jobs=8 //foo:bar) so that Bazel won't try to do as much at once.
  • If your machine has enough memory, you can up the amount Bazel is allowed to use by setting JVM startup options, e.g., --host_jvm_args=-Xmx15G --host_jvm_args=-Xms15G (bazel --host_jvm_args=-Xmx15G --host_jvm_args=-Xms15G build //foo:bar).

@jinhoonbang
Copy link
Author

Thanks! But I thought 'build' should only work when Bazel is compiled and I'm still having difficulty compiling bazel from source.
I cloned the newest version of Bazel, made necessary files on CROSSTOOL, ran ./compile.sh and got the following:

ERROR: No toolchain found for cpu 'piii'. Valid cpus are: [
k8,
armeabi-v7a,
].

The CROSSTOOL file from the fresh new clone had a default-toolchain with 'piii' as the cpu. This default-toolchain didn't exist in previous versions of Bazel. What is 'piii'? I tried compiling bazel again with the following lines below from the CROSSTOOL removed but still got the same error.

default_toolchain {
cpu: "piii"
toolchain_identifier: "local_linux"
}

@jinhoonbang
Copy link
Author

Also, please let me know what "more information" you need

@damienmg
Copy link
Contributor

We should rename that label.

@damienmg
Copy link
Contributor

piii is the identifier bazel use to identify x86_32, I understand the bug.

@damienmg damienmg added type: bug P1 I'll work on this now. (Assignee required) category: configurability labels Apr 19, 2016
@damienmg damienmg self-assigned this Apr 19, 2016
@jinhoonbang
Copy link
Author

jinhoonbang commented Apr 19, 2016

Even with the bug fix(0b26f44), I'm still getting the same error:
ERROR: No toolchain found for cpu 'piii'. Valid cpus are: [
k8,
armeabi-v7a,
].

Can we reopen the issue?

@damienmg damienmg reopened this Apr 19, 2016
@damienmg
Copy link
Contributor

what does uname -m gives on your machine?

@damienmg
Copy link
Contributor

can you try to replace result.stdout by result.stdout.strip() in 0b26f44#diff-3c392a08593f9fcb15e8267d7acc132dR108?

@jinhoonbang
Copy link
Author

uname -m returns x86_64.

Replacing result.stdout with results.stdout.strip() helped me get passed the error!
Here's what I got after running ./compile.sh,

INFO: You can skip this first step by providing a path to the bazel binary as second argument: INFO: ./compile.sh compile /path/to/bazel 🍃 Building Bazel from scratch../home/dkl524/jbang/jdk1.8.0_73/bin/javac -classpath third_party/aether/aether-api-1.0.0.v20140518.jar:third_party/aether/aether-connector-basic-1.0.0.v20140518.jar:third_party/aether/aether-impl-1.0.0.v20140518.jar:third_party/aether/aether-spi-1.0.0.v20140518.jar:third_party/aether/aether-transport-classpath-1.0.0.v20140518.jar:third_party/aether/aether-transport-file-1.0.0.v20140518.jar:third_party/aether/aether-transport-http-1.0.0.v20140518.jar:third_party/aether/aether-transport-wagon-1.0.0.v20140518.jar:third_party/aether/aether-util-1.0.0.v20140518.jar:third_party/android_common/com.android.tools.build_builder-model_0.13.3.jar:third_party/android_common/com.android.tools.build_builder_0.13.3.jar:third_party/android_common/com.android.tools.build_manifest-merger_23.1.3.jar:third_party/android_common/com.android.tools.layoutlib_layoutlib_23.1.3.jar:third_party/android_common/com.android.tools_common_23.1.3.jar:third_party/android_common/com.android.tools_sdk-common_23.1.3.jar:third_party/android_common/com.android.tools_sdklib_23.1.3.jar:third_party/apache_commons_codec/commons-codec-1.9.jar:third_party/apache_commons_collections/commons-collections-3.2.2.jar:third_party/apache_commons_compress/apache-commons-compress-1.9.jar:third_party/apache_commons_lang/commons-lang-2.6.jar:third_party/apache_commons_logging/commons-logging-1.1.1.jar:third_party/apache_commons_pool2/commons-pool2-2.3.jar:third_party/apache_httpclient/httpclient-4.2.5.jar:third_party/apache_httpcore/httpcore-4.2.4.jar:third_party/apache_velocity/velocity-1.7.jar:third_party/asm/asm-5.0.3.jar:third_party/asm/asm-5.0.4.jar:third_party/asm/asm-commons-5.0.4.jar:third_party/asm/asm-util-5.0.4.jar:third_party/auto/auto-common-0.3.jar:third_party/auto/auto-service-1.0-rc2.jar:third_party/auto/auto-value-1.2.jar:third_party/bytebuddy/byte-buddy-dep-0.7-rc6.jar:third_party/checker_framework_dataflow/dataflow-1.8.10.jar:third_party/error_prone/error_prone_annotation-2.0.9-20160129.jar:third_party/error_prone/error_prone_annotations-2.0.9-20160129.jar:third_party/error_prone/error_prone_core-2.0.9-20160129.jar:third_party/grpc/grpc-all-0.13.2.jar:third_party/gson/gson-2.2.4.jar:third_party/guava/guava-19.0.jar:third_party/guava/guava-testlib.jar:third_party/guice/guice-4.0-no_aop.jar:third_party/guice/guice-multibindings-4.0.jar:third_party/hamcrest/hamcrest-core-1.3.jar:third_party/hazelcast/hazelcast-3.5.4.jar:third_party/hazelcast/hazelcast-client-3.5.4.jar:third_party/ijar/test/libwrongcentraldir.jar:third_party/java/dd_plist/libdd_plist.jar:third_party/java/jarjar/jarjar-1.4.jar:third_party/java/jdk/langtools/javac.jar:third_party/jcip_annotations/jcip-annotations-1.0-1.jar:third_party/jformatstring/jFormatString-3.0.0.jar:third_party/jgit/org.eclipse.jgit-4.0.1.201506240215-r.jar:third_party/jimfs/jimfs-1.1-rc1.jar:third_party/joda_time/joda-time-2.3.jar:third_party/jsch/jsch-0.1.51.jar:third_party/jsr305/jsr-305.jar:third_party/jsr330_inject/javax.inject.jar:third_party/junit/junit-4.11.jar:third_party/maven/maven-builder-support-3.3.3.jar:third_party/maven/maven-settings-3.3.3.jar:third_party/maven/maven-settings-builder-3.3.3.jar:third_party/maven_model/maven-aether-provider-3.2.3.jar:third_party/maven_model/maven-model-3.2.3.jar:third_party/maven_model/maven-model-builder-3.2.3.jar:third_party/maven_model/maven-repository-metadata-3.2.3.jar:third_party/mockito/mockito-all-1.10.19.jar:third_party/netty/netty-all-4.1.0.CR6.jar:third_party/pcollections/pcollections-2.1.2.jar:third_party/plexus_component_annotations/plexus-component-annotations-1.6.jar:third_party/plexus_interpolation/plexus-interpolation-1.22.jar:third_party/plexus_utils/plexus-utils-3.0.21.jar:third_party/protobuf/protobuf-java-3.0.0-beta-1.jar:third_party/slf4j/slf4j-api-1.7.7.jar:third_party/slf4j/slf4j-jdk14-1.7.7.jar:third_party/tomcat_annotations_api/tomcat-annotations-api-8.0.5.jar:third_party/truth/truth-0.28.jar:third_party/xz/xz-1.5.jar::/tmp/bazel.P692pmbJ -sourcepath src/java_tools/singlejar/java/com/google/devtools/build/zip:src/main/java:src/tools/xcode-common/java/com/google/devtools/build/xcode/common:src/tools/xcode-common/java/com/google/devtools/build/xcode/util:/tmp/bazel.P692pmbJ/src -d /tmp/bazel.P692pmbJ/classes -source 1.8 -target 1.8 -encoding UTF-8 @/tmp/bazel.cmpIumMW/param src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:19: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:20: 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/server/signal/InterruptSignalHandler.java:16: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:19: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:20: 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/server/signal/InterruptSignalHandler.java:16: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:19: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:20: 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/server/signal/InterruptSignalHandler.java:16: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:19: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:20: 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/server/signal/InterruptSignalHandler.java:16: warning: Signal is internal proprietary API and may be removed in a future release import sun.misc.Signal; ^ src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java:33: error: error while writing DigestUtils: No space left on device public class DigestUtils { ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:30: warning: Signal is internal proprietary API and may be removed in a future release private final Signal signal; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:31: warning: SignalHandler is internal proprietary API and may be removed in a future release private SignalHandler oldHandler; ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:38: warning: Signal is internal proprietary API and may be removed in a future release protected AbstractSignalHandler(Signal signal) { ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:43: warning: SignalHandler is internal proprietary API and may be removed in a future release new SignalHandler() { ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:45: warning: Signal is internal proprietary API and may be removed in a future release public void handle(Signal signal) { ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:41: warning: Signal is internal proprietary API and may be removed in a future release Signal.handle( ^ src/main/java/com/google/devtools/build/lib/server/signal/AbstractSignalHandler.java:56: warning: Signal is internal proprietary API and may be removed in a future release Signal.handle(signal, oldHandler); ^ src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release private static final Signal SIGINT = new Signal("INT"); ^ src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:20: warning: Signal is internal proprietary API and may be removed in a future release private static final Signal SIGINT = new Signal("INT"); ^ src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:32: warning: Signal is internal proprietary API and may be removed in a future release private static final Signal SIGUSR2 = new Signal("USR2"); ^ src/main/java/com/google/devtools/build/lib/runtime/OomSignalHandler.java:32: warning: Signal is internal proprietary API and may be removed in a future release private static final Signal SIGUSR2 = new Signal("USR2"); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error 27 warnings

@damienmg
Copy link
Contributor

It says "no space left on device"

@jinhoonbang
Copy link
Author

Oops. Hmm, the issue is persistent. I've tried adding result.stdout.strip() but still giving the same error.

@damienmg
Copy link
Contributor

Uname says your machine is 64 b it should not use piii

@damienmg
Copy link
Contributor

  X86_32("x86_32", ImmutableSet.of("i386", "i486", "i586", "i686", "i786", "x86")),
  X86_64("x86_64", ImmutableSet.of("amd64", "x86_64", "x64")),
...

  private static CPU determineCurrentCpu() {
    String currentArch = OS_ARCH.value();

    for (CPU cpu : CPU.values()) {
      if (cpu.archs.contains(currentArch)) {
        return cpu;
      }
    }

    return CPU.UNKNOWN;
  }

Seriously? It means that os.arch contains x86_64 it returns x86_32 because of x86... It depends on the order of iteration of CPU.values() of course, but this code seems wrong. I guess that's the problem

@damienmg
Copy link
Contributor

@damienmg
Copy link
Contributor

Could you run the following bash script on your machine and tells me what it prints out?

#!/bin/bash

cat >/tmp/CPU.java <<EOF
public enum CPU {

  X86_32("x86_32", "i386", "i486", "i586", "i686", "i786", "x86"), //
  X86_64("x86_64", "amd64", "x86_64", "x64"), //
  UNKNOWN("unknown");

  private final String canonicalName;
  private final String[] archs;

  CPU(String canonicalName, String... archs) {
    this.canonicalName = canonicalName;
    this.archs = archs;
  }

  private static CPU determineCurrentCpu() {
    String currentArch = System.getProperty("os.arch");
    System.out.println("os.arch = " + currentArch);
    for (CPU cpu : CPU.values()) {
      for (String arch : cpu.archs) {
        if (arch.equals(currentArch)) {
          return cpu;
        }
      }
    }

    return CPU.UNKNOWN;
  }

  public static void main(String[] args) {
    System.out.println("CPU = " + determineCurrentCpu().canonicalName);
  }
}
EOF
(cd /tmp && javac CPU.java && java CPU)
rm -f /tmp/CPU.java

@jinhoonbang
Copy link
Author

After running the script, I get the following:
os.arch = i386
CPU = x86_32

@damienmg
Copy link
Contributor

Oh I see you have a 32-bit JDK on a 64-bit machine... Can you change to a 64 bit JDK?

@jinhoonbang
Copy link
Author

I Installed 64 bit JDK and bazel no longer complains about 'piii'. I'm back to JVM memory errory: "Error occurred during initialization of VM. Cannot create VM thread. Out of system resources." I'm assuming the error has to do with how my JVM is configured.

@jinhoonbang
Copy link
Author

The source of error was the max user process limit. I increased ulimit - u and I can compile bazel now.

@damienmg
Copy link
Contributor

\o/

damienmg added a commit that referenced this issue Apr 21, 2016
damienmg added a commit that referenced this issue Apr 21, 2016
As noticed in #1122.

--
MOS_MIGRATED_REVID=120315240
damienmg added a commit that referenced this issue Apr 22, 2016
damienmg added a commit that referenced this issue Apr 22, 2016
As noticed in #1122.

--
MOS_MIGRATED_REVID=120315240
@flanciskinho
Copy link

@jinhoonbang , I have a question for you.

what value do you set for 'max user process limit' to compile bazel?

Thanks in advance

@kmpont
Copy link

kmpont commented Dec 9, 2016

@flanciskinho I have just successfully bootstrapped bazel 0.4.2 (just released) on RHEL6 with:

 cd ~/build/deep/bazel
  rm -rf *
  unzip -q ../bazel-0.4.2-dist.zip
  ulimit -u2048
  ulimit -a
  nohup ./compile.sh | tee compile.log

The ulimit -a shows:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 257485
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2048
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Regards

@truatpasteurdotfr
Copy link

https://people.centos.org/~tru/bazel-centos6/ contains the spec file, source and binary bazel 0.4.5 rpms. It's just a POC, the packages are unsigned on purpose. You can rebuild yourself with rpmbuild -ba bazel.spec (cf https://wiki.centos.org/HowTos/SetupRpmBuildEnvironment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) type: bug
Projects
None yet
Development

No branches or pull requests

7 participants