bazel: Too many unrelated "xcode version must be specified" errors

Description of the problem / feature request:

I’ve been working the past few days on rules_scala and its toolchain and I got several times the following message:

ERROR: /private/var/tmp/.../.../external/local_config_cc/BUILD:50:5: in apple_cc_toolchain rule @local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified to use an Apple CROSSTOOL. If your Xcode version has changed recently, try: "bazel clean --expunge" to re-run Xcode configuration

rules_scala has no c/cpp code of itself but maybe the toolchain triggers something. Additionally I did not change anything about my Xcode version and in fact I’m pretty certain it’s not fully installed since when I open the app it says something about needing to install additional components.

If I run clean expunge it fixes the problem but I don’t think this is a valid solution.

What operating system are you running Bazel on?

OS X Sierra

What’s the output of bazel info release?

release 0.15.0-homebrew

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 30 (23 by maintainers)

Commits related to this issue

Most upvoted comments

redisliu’s solution from https://github.com/bazelbuild/bazel/issues/4314 works for me sudo xcode-select -s /Applications/Xcode.app/Contents/Developer; sudo xcodebuild -license; bazel clean --expunge; Reference: https://stackoverflow.com/questions/45276830/xcode-version-must-be-specified-to-use-an-apple-crosstool

When you meet this problem, enter " xcode-select". Then follow the “reset” step, this problem will never happen.

sudo xcode-select --reset