Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Trouble with building using Bazel #54

Closed
ciera opened this issue Jun 29, 2015 · 6 comments
Closed

Trouble with building using Bazel #54

ciera opened this issue Jun 29, 2015 · 6 comments

Comments

@ciera
Copy link
Contributor

ciera commented Jun 29, 2015

I got the following email from Yu Lin.

I can't build shipshape anymore (my plugin works fine before this upgrade), it gives the following error:

____Loading...
____Loading complete. Analyzing...
____Found 171 targets...
blaze: Entering directory /home/yulin/.cache/bazel/_bazel_yulin/5f4d978cf0eb54a79459fe5f5f58e11b/s2/' ____[0 / 38] BazelWorkspaceStatusAction stable-status.txt ____From ProtocJava shipshape/proto/shipshape_config_proto_java_src.srcjar: /bin/bash: line 4: jar: command not found ERROR: /home/yulin/Downloads/s2/tools/build_rules/genproto.bzl:127:5: error executing shell command: 'set -e rm -rf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs mkdir bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_pr...' failed: bash failed: error executing com\ mand (cd /home/yulin/.cache/bazel/_bazel_yulin/5f4d978cf0eb54a79459fe5f5f58e11b/s2 && \ exec env - \ /bin/bash -c 'set -e rm -rf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs mkdir bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs bazel-out/local_linux-fastbuild/bin/third_party/proto/protoc --java_out=bazel-out/local_linux-fastbuild/genfiles/shipshape/prot\ o/shipshape_config_proto_java_src.srcjar.srcs shipshape/proto/shipshape_config.proto jar cMf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar -C bazel-out/local_linu\ x-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs . rm -rf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs'): com.google.devto\ ols.build.lib.shell.BadExitStatusException: Process exited with status 127: bash failed: error executing command (cd /home/yulin/.cache/bazel/_bazel_yulin/5f4d978cf0eb54a79459fe5f5f58e11b/s2 && \ exec env - \ /bin/bash -c 'set -e rm -rf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs mkdir bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs bazel-out/local_linux-fastbuild/bin/third_party/proto/protoc --java_out=bazel-out/local_linux-fastbuild/genfiles/shipshape/prot\ o/shipshape_config_proto_java_src.srcjar.srcs shipshape/proto/shipshape_config.proto jar cMf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar -C bazel-out/local_linu\ x-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs . rm -rf bazel-out/local_linux-fastbuild/genfiles/shipshape/proto/shipshape_config_proto_java_src.srcjar.srcs'): com.google.devto\ ols.build.lib.shell.BadExitStatusException: Process exited with status 127. blaze: Leaving directory/home/yulin/.cache/bazel/_bazel_yulin/5f4d978cf0eb54a79459fe5f5f58e11b/s2/'
____Building complete.
____Elapsed time: 1.021s, Critical Path: 0.55s

It says "jar: command not found", but jar can be executed actually. Do you know why?

@collinw
Copy link
Contributor

collinw commented Jun 29, 2015

What version of Bazel is Yu Lin using?

@yulin2
Copy link

yulin2 commented Jun 29, 2015

I cloned it from github bazel's master branch. I found if I cp 'jar' into /usr/bin, I can compile.

@collinw
Copy link
Contributor

collinw commented Jun 29, 2015

Is jar not on your PATH by default?

@yulin2
Copy link

yulin2 commented Jun 29, 2015

It is on my path and I can execute it. But bazel still reports "jar: command not found".
However, after I did "ln -s real/path/to/jar /usr/bin/jar", I can compile. I think it might be a issue of bazel.
See here: bazelbuild/bazel#245

@collinw
Copy link
Contributor

collinw commented Jun 30, 2015

What is your JAVA_HOME? I just ran into my own problems using Bazel with a not-quite-right JAVA_HOME value: bazelbuild/bazel#268

@yulin2
Copy link

yulin2 commented Jun 30, 2015

My original JAVA_HOME was /usr/lib/jvm/java-7-openjdk-amd64. But I renamed java-7-openjdk-amd64 to openjdk-7 and set JAVA_HOME to /usr/lib/jvm/openjdk-7 (because I couldn't build the master branch of bazel when using name java-7-openjdk-amd64). Probably this action broke the symlink usr/bin/jar -> /etc/alternatives/jar -> /usr/lib/jvm/java-7-openjdk-amd64/bin/jar, thus raised the above error.

Now that I checkout bazel version 43b2ea7, I can build it using JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64. I restored the symlinks, and now I can build shipshape.

@collinw collinw closed this as completed Jul 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants