bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Apple rules print stack trace on ./compile.sh

Open kchodorow opened this issue 10 years ago • 13 comments

Just got a fresh, new Macbook Air and tried to compile Bazel on it:

Kristinas-MacBook-Air:bazel k$ ./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.......
🍃  Building Bazel with Bazel.
.WARNING: /var/folders/kq/jk5hkhtd3ds7xgyb7024rycr0000gn/T/bazel_HtZukCww/out/external/bazel_tools/WORKSPACE:1: Workspace name in /var/folders/kq/jk5hkhtd3ds7xgyb7024rycr0000gn/T/bazel_HtZukCww/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
WARNING: /var/folders/kq/jk5hkhtd3ds7xgyb7024rycr0000gn/T/bazel_HtZukCww/out/external/bazel_tools/tools/osx/xcode_configure.bzl:85:5: Invoking xcode-locator failed, return code %s, stderr: %s 1 .
WARNING: /var/folders/kq/jk5hkhtd3ds7xgyb7024rycr0000gn/T/bazel_HtZukCww/out/external/bazel_tools/tools/osx/xcode_configure.bzl:88:5: Invoking xcodebuild failed, return code %s, stderr: %s 1 xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
.
WARNING: /var/folders/kq/jk5hkhtd3ds7xgyb7024rycr0000gn/T/bazel_HtZukCww/out/external/bazel_tools/tools/osx/xcode_configure.bzl:57:5: Invoking xcodebuild failed, return code %s, stderr: %s 1 xcrun: error: missing DEVELOPER_DIR path:  E.g. no application claims the file"
.
Unhandled exception thrown during build; message: Unrecoverable error while evaluating node 'CONFIGURATION_FRAGMENT:ConfigurationFragmentKey(class=com.google.devtools.build.lib.rules.apple.AppleConfiguration, checksum=a9f4766fe5314f761bfd429c134760bb)' (requested by nodes 'CONFIGURATION_COLLECTION:com.google.devtools.build.lib.skyframe.ConfigurationCollectionValue$ConfigurationCollectionKey@f0ec3898')
INFO: Elapsed time: 3.083s
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURATION_FRAGMENT:ConfigurationFragmentKey(class=com.google.devtools.build.lib.rules.apple.AppleConfiguration, checksum=a9f4766fe5314f761bfd429c134760bb)' (requested by nodes 'CONFIGURATION_COLLECTION:com.google.devtools.build.lib.skyframe.ConfigurationCollectionValue$ConfigurationCollectionKey@f0ec3898')
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:446)
    at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:496)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Dotted version components must all be of the form \d+([a-z]+\d*)? but got error
    at com.google.devtools.build.lib.rules.apple.DottedVersion.toComponent(DottedVersion.java:105)
    at com.google.devtools.build.lib.rules.apple.DottedVersion.fromString(DottedVersion.java:89)
    at com.google.devtools.build.lib.rules.apple.XcodeVersionRuleData.<init>(XcodeVersionRuleData.java:46)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.aliasesToVersionMap(XcodeConfig.java:169)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.resolveExplicitlyDefinedVersion(XcodeConfig.java:106)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.resolveXcodeVersion(XcodeConfig.java:79)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.getXcodeVersionProperties(AppleConfiguration.java:525)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.create(AppleConfiguration.java:467)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.create(AppleConfiguration.java:462)
    at com.google.devtools.build.lib.skyframe.ConfigurationFragmentFunction.compute(ConfigurationFragmentFunction.java:77)
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:387)
    ... 4 more
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURATION_FRAGMENT:ConfigurationFragmentKey(class=com.google.devtools.build.lib.rules.apple.AppleConfiguration, checksum=a9f4766fe5314f761bfd429c134760bb)' (requested by nodes 'CONFIGURATION_COLLECTION:com.google.devtools.build.lib.skyframe.ConfigurationCollectionValue$ConfigurationCollectionKey@f0ec3898')
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:446)
    at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:496)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Dotted version components must all be of the form \d+([a-z]+\d*)? but got error
    at com.google.devtools.build.lib.rules.apple.DottedVersion.toComponent(DottedVersion.java:105)
    at com.google.devtools.build.lib.rules.apple.DottedVersion.fromString(DottedVersion.java:89)
    at com.google.devtools.build.lib.rules.apple.XcodeVersionRuleData.<init>(XcodeVersionRuleData.java:46)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.aliasesToVersionMap(XcodeConfig.java:169)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.resolveExplicitlyDefinedVersion(XcodeConfig.java:106)
    at com.google.devtools.build.lib.rules.apple.XcodeConfig.resolveXcodeVersion(XcodeConfig.java:79)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.getXcodeVersionProperties(AppleConfiguration.java:525)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.create(AppleConfiguration.java:467)
    at com.google.devtools.build.lib.rules.apple.AppleConfiguration$Loader.create(AppleConfiguration.java:462)
    at com.google.devtools.build.lib.skyframe.ConfigurationFragmentFunction.compute(ConfigurationFragmentFunction.java:77)
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:387)
    ... 4 more
  1. Bazel shouldn't require XCode to be installed.
  2. Even if it does, it shouldn't stack trace if it's not!

kchodorow avatar Sep 10 '16 15:09 kchodorow

Well it needs Xcode to get gcc and git no?

damienmg avatar Sep 10 '16 15:09 damienmg

(definitely +1 on the should not stack trace).

damienmg avatar Sep 10 '16 15:09 damienmg

No, it need command line tools (which I have installed).

kchodorow avatar Sep 10 '16 15:09 kchodorow

Oh I see indeed, it should not require to have Xcode installed either.

damienmg avatar Sep 10 '16 15:09 damienmg

Note that my pull request just improves the error message xcode_configure.bzl is printing. It does not address anything about AppleConfiguration being overzealous about XCode existing.

kchodorow avatar Sep 10 '16 16:09 kchodorow

Our mac tests (bazel_objc_test, bazel_apple_test) rely on iOS SDK being present, which you only get with Xcode installed. I can only guess that that is why Xcode presence is assumed.

dmishe avatar Sep 13 '16 17:09 dmishe

Is there anyway to get around this error? I am getting the exact same error as op on my macbook air. I do not have Xcode, but do have command line tools. I am unable to install bazel.

amrit-poudel avatar Sep 16 '16 20:09 amrit-poudel

FWIW, you can install Bazel using the binary installer (e.g., https://github.com/bazelbuild/bazel/releases/tag/0.3.1), you just can't build bazel.

kchodorow avatar Sep 16 '16 20:09 kchodorow

Following your suggestion, I installed bazel for macosx using the installer. However, I get the following error when trying to use bazel to build tensorflow from the source.

gcc: error: unrecognized command line option '-Wthread-safety' gcc: error: unrecognized command line option '-Wself-assign'

The exact same problem was reported in #649 , where you suggested to edit CROSSTOOL but I am unable to do that since I did not build bazel from the source.

Do you have any other suggestions to resolve this error? Thanks a lot.

amrit-poudel avatar Sep 18 '16 00:09 amrit-poudel

Add the following to your WORKSPACE file:

local_repository(
    name = "bazel_tools",
    path = "/path/to/the/bazel/source/tree"
)

Then edit the CROSSTOOL file in /path/to/the/bazel/source/tree/tools/cpp/CROSSTOOL.

kchodorow avatar Sep 19 '16 13:09 kchodorow

I added those lines to WORKSPACE file (from tensorflow source tree) and updated CROSSTOOL (bazel source tree), however I still get the same error.

amrit-poudel avatar Sep 19 '16 14:09 amrit-poudel

This was fixed by @c-parsons, closing.

calpeyser avatar Sep 22 '16 14:09 calpeyser

In particular, fixed by cc867d4b7a2a42188ba5ef5114dad2c2fab60351.

kchodorow avatar Sep 22 '16 14:09 kchodorow