bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.23k stars 4.07k forks source link

generate_workspace doesn't work #776

Closed dfabulich closed 8 years ago

dfabulich commented 8 years ago

On latest master 1f1658c5bbaf540bd2080be3cbcea3df2ca9bf9b, OSX 10.11.2

dfab: /tmp/bazel $ bazel run //src/tools/generate_workspace
ERROR: /private/tmp/tp/bazel/WORKSPACE:1:6: file '/tools/build_defs/d/d.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:2:6: file '/tools/build_defs/dotnet/csharp.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:3:6: file '/tools/build_defs/jsonnet/jsonnet.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:4:6: file '/tools/build_defs/sass/sass.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:5:6: file '/tools/build_rules/go/def.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:6:6: file '/tools/build_rules/rust/rust.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/tp/bazel/WORKSPACE:8:1: name 'csharp_repositories' is not defined.
ERROR: /private/tmp/tp/bazel/WORKSPACE:9:1: name 'd_repositories' is not defined.
ERROR: /private/tmp/tp/bazel/WORKSPACE:10:1: name 'go_repositories' is not defined.
ERROR: /private/tmp/tp/bazel/WORKSPACE:11:1: name 'jsonnet_repositories' is not defined.
ERROR: /private/tmp/tp/bazel/WORKSPACE:12:1: name 'rust_repositories' is not defined.
ERROR: /private/tmp/tp/bazel/WORKSPACE:13:1: name 'sass_repositories' is not defined.
ERROR: Error evaluating WORKSPACE file /private/tmp/bazel/WORKSPACE.
ERROR: no such package 'external': Package 'external' contains errors.
INFO: Elapsed time: 0.046s.
ERROR: Build failed. Not running target.

I ran a git bisect which says that "07b0ba6079022d9a9643d46b28aa4d2a75334b35 is the first bad commit"

dfab: /tmp/bazel $ git checkout 07b0ba6079022d9a9643d46b28aa4d2a75334b35
Note: checking out '07b0ba6079022d9a9643d46b28aa4d2a75334b35'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 07b0ba6... [rust] Use load() to add external repositories.
dfab: /tmp/bazel $ bazel run //src/tools/generate_workspace
ERROR: /private/tmp/bazel/WORKSPACE:1:6: file '/tools/build_rules/rust/rust.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /private/tmp/bazel/WORKSPACE:3:1: name 'rust_repositories' is not defined.
ERROR: Error evaluating WORKSPACE file /private/tmp/bazel/WORKSPACE.
ERROR: no such package 'external': Package 'external' contains errors.
INFO: Elapsed time: 0.072s.
ERROR: Build failed. Not running target.
damienmg commented 8 years ago

bazel version?

kchodorow commented 8 years ago

It looks like your version of bazel is too old to understand HEAD's WORKSPACE file format. Can you try recompiling bazel from scratch (using ./compile.sh), then using that to build anything you're doing at HEAD?

Bazel 0.1.2 cannot understand HEAD's WORKSPACE file (I haven't tried 0.1.3, that might work).

damienmg commented 8 years ago

0.1.3 should work

On Mon, Jan 11, 2016 at 10:07 PM Kristina notifications@github.com wrote:

It looks like your version of bazel is too old to understand HEAD's WORKSPACE file format. Can you try recompiling bazel from scratch (using ./compile.sh), then using that to build anything you're doing at HEAD?

Bazel 0.1.2 cannot understand HEAD's WORKSPACE file (I haven't tried 0.1.3, that might work).

— Reply to this email directly or view it on GitHub https://github.com/bazelbuild/bazel/issues/776#issuecomment-170690130.

dfabulich commented 8 years ago

You are correct! ./compile.sh took care of it for me.

dfabulich commented 8 years ago

For the record, I was indeed on Bazel 0.1.2, the latest version available on Homebrew.

damienmg commented 8 years ago

FYI I just send a PR to homebrew to update to 0.1.3 :)

On Mon, Jan 11, 2016 at 11:53 PM dfabulich notifications@github.com wrote:

For the record, I was indeed on Bazel 0.1.2, the latest version available on Homebrew.

— Reply to this email directly or view it on GitHub https://github.com/bazelbuild/bazel/issues/776#issuecomment-170720844.

dfabulich commented 8 years ago

I downloaded @damienmg's updated homebrew formula, ran it, and found that generate_workspace doesn't work with that, either.

dfab: /tmp/bazel $ bazel run //src/tools/generate_workspace
INFO: Found 1 target...
INFO: From Building src/main/java/com/google/devtools/build/lib/rules/objc/libobjc.jar (81 files):
src/main/java/com/google/devtools/build/lib/rules/objc/PlMergeControlBytes.java:67: error: cannot find symbol
      control.putAllVariableSubstitutionMap(bundling.variableSubstitutions());
             ^
  symbol:   method putAllVariableSubstitutionMap(Map<String,String>)
  location: variable control of type Builder
Note: src/main/java/com/google/devtools/build/lib/rules/objc/IterableWrapper.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
BazelJavaBuilder threw exception: java compilation returned status ERROR
ERROR: /private/tmp/bazel/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD:8:1: Java compilation in rule '//src/main/java/com/google/devtools/build/lib/rules/objc:objc' failed: java failed: error executing command external/local-jdk/bin/java -Xbootclasspath/p:external/bazel_tools/third_party/java/jdk/langtools/javac.jar -client -jar external/bazel_tools/tools/jdk/JavaBuilder_deploy.jar ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Target //src/tools/generate_workspace:generate_workspace failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.897s, Critical Path: 2.82s
ERROR: Build failed. Not running target.
dfab: /tmp/bazel $ bazel version
Build label: 0.1.3-homebrew
Build target: bazel-out/local_darwin-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Jan 11 23:26:02 2016 (1452554762)
Build timestamp: 1452554762
Build timestamp as int: 1452554762
dfab: /tmp/bazel $ git rev-parse HEAD
6ba5c97e9ad94b307b3383d9d18c9ef30e3f8322
dfabulich commented 8 years ago

bisect points to 4bd593aaad907f4266ad510fb395638f2126a4ea as the offending commit. Still works fine if I use ./compile.sh instead of a bazel binary.

damienmg commented 8 years ago

We should recommend instead to clone the same version of the repository (e.g. tag 0.1.3 if you are running with Bazel 0.1.3).