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

homebrew build does not work for 0.5rc3 #2953

Closed
damienmg opened this issue May 5, 2017 · 9 comments
Closed

homebrew build does not work for 0.5rc3 #2953

damienmg opened this issue May 5, 2017 · 9 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug
Milestone

Comments

@damienmg
Copy link
Contributor

damienmg commented May 5, 2017

Output:

==> Downloading https://storage.googleapis.com/bazel/0.5/rc3/bazel-0.5rc3-dist.z
######################################################################## 100.0%
Warning: Cannot verify integrity of bazel-0.5rc3.zip
A checksum was not provided for this resource
For your reference the SHA256 is: 54d6948e603c0fb3574d14bb8049afb915026ea171fd8b0153acc05798a5b089
==> ./compile.sh
Last 15 lines from /Users/dmarting/Library/Logs/Homebrew/bazel/01.compile.sh:
  (cd /tmp/bazel_szWzhipD/out/execroot/bazel-20170505-28227-1peswy3 && \
  exec env - \
    PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin:/Users/dmarting/homebrew/Library/Homebrew/shims/super:/usr/bin:/bin:/usr/sbin:/sbin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/local-opt/bin/third_party/protobuf/3.2.0/_objs/protobuf_lite/third_party/protobuf/3.2.0/src/google/protobuf/generated_message_util.d '-frandom-seed=bazel-out/local-opt/bin/third_party/protobuf/3.2.0/_objs/protobuf_lite/third_party/protobuf/3.2.0/src/google/protobuf/generated_message_util.o' -iquote . -iquote bazel-out/local-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem third_party/protobuf/3.2.0/src -isystem bazel-out/local-opt/genfiles/third_party/protobuf/3.2.0/src -isystem external/bazel_tools/tools/cpp/gcc3 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c third_party/protobuf/3.2.0/src/google/protobuf/generated_message_util.cc -o bazel-out/local-opt/bin/third_party/protobuf/3.2.0/_objs/protobuf_lite/third_party/protobuf/3.2.0/src/google/protobuf/generated_message_util.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
/Users/dmarting/homebrew/Library/Homebrew/shims/super/clang:34:in `escape': no implicit conversion of nil into String (TypeError)
	from /Users/dmarting/homebrew/Library/Homebrew/shims/super/clang:34:in `initialize'
	from /Users/dmarting/homebrew/Library/Homebrew/shims/super/clang:363:in `new'
	from /Users/dmarting/homebrew/Library/Homebrew/shims/super/clang:363:in `<main>'
Target //src:bazel failed to build
INFO: Elapsed time: 8.148s, Critical Path: 0.19s

ERROR: Could not build Bazel

git diff:

diff --git a/Formula/bazel.rb b/Formula/bazel.rb
index b847cf5..4f1aa25 100644
--- a/Formula/bazel.rb
+++ b/Formula/bazel.rb
@@ -1,8 +1,9 @@
 class Bazel < Formula
   desc "Google's own build tool"
   homepage "https://bazel.build/"
-  url "https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-dist.zip"
-  sha256 "2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b"
+  url "https://storage.googleapis.com/bazel/0.5/rc3/bazel-0.5rc3-dist.zip"
+# https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-dist.zip"
+  # sha256 "2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b"
 
   bottle do
     cellar :any_skip_relocation
@damienmg
Copy link
Contributor Author

damienmg commented May 5, 2017

(note that bootstrapping outside of homebrew works no problem)

@damienmg damienmg added Release blocker P1 I'll work on this now. (Assignee required) type: bug labels May 5, 2017
@damienmg
Copy link
Contributor Author

damienmg commented May 5, 2017

Confirmed on my other laptop. Same error.

@damienmg damienmg self-assigned this May 5, 2017
@philwo
Copy link
Member

philwo commented May 5, 2017

Seems like a bug in Homebrew's clang wrapper...

@philwo
Copy link
Member

philwo commented May 5, 2017

The failing line seems to be this:
@keg_regex = %r[(#{Regexp.escape(opt)}|#{Regexp.escape(cellar)})/([\w+-.@]+)]

I guess either opt or cellar are nil, when they should be a String. opt is defined as @opt = ENV["HOMEBREW_OPT"] and cellar as @cellar = ENV["HOMEBREW_CELLAR"].

Does that help somehow?

@damienmg
Copy link
Contributor Author

damienmg commented May 5, 2017

Yes that means that we strip out HOMEBREW_OPT or HOMEBREW_CELLAR. This was my first idea too that we stopped shipping some environment variable. I would suspect a change by Nicolas on cc_configure.bzl, let me confirm that.

@damienmg damienmg added this to the 0.5 milestone May 8, 2017
@damienmg
Copy link
Contributor Author

damienmg commented May 8, 2017

Ok this is due to a weird bug:

cc_configure doesn't see the whole environment, just the subset from the environ variable.

@damienmg
Copy link
Contributor Author

damienmg commented May 8, 2017

I could not repro on Linux with:

[dmarting@trantor] /tmp/WORKSPACE$ cat test.bzl 
def _impl(rctx):
  print(rctx.os.environ)
  rctx.file("BUILD", "")


test_rule = repository_rule(
  environ=["TEST"],
  implementation=_impl,
)
[dmarting@trantor] /tmp/WORKSPACE$ cat WORKSPACE 
load("//:test.bzl", "test_rule")
test_rule(name = "test")
[dmarting@trantor] /tmp/WORKSPACE$ cat BUILD 
[dmarting@trantor] /tmp/WORKSPACE$ 

So either this is a darwin bug, something specific to homebrew env or in cc_configure.

@damienmg
Copy link
Contributor Author

damienmg commented May 8, 2017

Ok cannot repro with that example in the homebrew env, so cc_configure looks like more and more like a suspect.

@damienmg
Copy link
Contributor Author

damienmg commented May 8, 2017

Of course, the issue is that we do not pass all environment variable during bootstrap, we should fix that.

hlopko pushed a commit that referenced this issue May 10, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 10, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 10, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 11, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 17, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 17, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 23, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
damienmg added a commit that referenced this issue May 26, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
hlopko pushed a commit that referenced this issue May 31, 2017
We might be using more environment variables that the actual list.

To be cherry-picked for #2692.

Fixes #2953.

Change-Id: I9b926d48e14b2c65822770ab46f6507a5303c3d3
PiperOrigin-RevId: 155387369
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

2 participants