getting Xcode-related error with Bazel

665 views
Skip to first unread message

Janak Ramakrishnan

unread,
Apr 24, 2018, 1:06:21 PM4/24/18
to bazel-discuss
I'm getting the error:

$ bazel build src/main/java/... -k

.............

ERROR: /private/var/tmp/_bazel_janakr/449f66540f7a827a317d06e34f37f945/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


Running "bazel clean --expunge" doesn't seem to help. I have Xcode 9.3 installed, Bazel 0.12. By the way, following the instructions to enable Xcode for all users gives me an error:

$ sudo xcodebuild -license accept

Password: 

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance


László Csomor

unread,
Apr 25, 2018, 2:43:25 AM4/25/18
to jan...@google.com, bazel-...@googlegroups.com, Christopher Parsons, Peter Schmitt
/cc Apple rule folks


--
László Csomor | Software Engineer | laszlo...@google.com

Google Germany GmbH | Erika-Mann-Str. 33 | 80636 München | Germany
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAF7sfHD%2Bs1ODu0DiRHJW%2Buo16ZDFWCKheS0RAR%3DrqaUbc8VrLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Marcel Hlopko

unread,
Apr 25, 2018, 2:57:24 AM4/25/18
to László Csomor, Janak Ramakrishnan, bazel-discuss, Christopher Parsons, Peter Schmitt
Hi Janak,

either export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1, or install full xcode (the error suggests that you only installed xcode command line tools, you can verify by trying to open Xcode app).


For more options, visit https://groups.google.com/d/optout.


--
Marcel Hlopko | Software Engineer | hlo...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

Janak Ramakrishnan

unread,
Apr 25, 2018, 11:17:31 AM4/25/18
to Marcel Hlopko, László Csomor, bazel-discuss, Christopher Parsons, Peter Schmitt
I'm able to open the full Xcode app (I get a "Welcome to Xcode" screen with
options for starting a project).

Philipp Wollermann

unread,
Apr 25, 2018, 3:50:32 PM4/25/18
to Janak Ramakrishnan, Marcel Hlopko, László Csomor, bazel-discuss, Christopher Parsons, Peter Schmitt
What's the output of "xcode-select -p"?


For more options, visit https://groups.google.com/d/optout.


--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Janak Ramakrishnan

unread,
Apr 25, 2018, 3:52:49 PM4/25/18
to Philipp Wollermann, Marcel Hlopko, László Csomor, bazel-discuss, Christopher Parsons, Peter Schmitt
/Library/Developer/CommandLineTools
On Wed, Apr 25, 2018 at 7:50 PM Philipp Wollermann <phi...@google.com>
wrote:

Philipp Wollermann

unread,
Apr 25, 2018, 4:01:32 PM4/25/18
to Janak Ramakrishnan, Marcel Hlopko, László Csomor, bazel-discuss, Christopher Parsons, Peter Schmitt
Yeah, I think that happens when the Command-Line Tools get installed after
(or was it before?) Xcode gets installed.
It then sticks to the CLT version of the tools.

You should be able to reset it to use Xcode:

# Reset to Xcode.
$ sudo xcode-select -r

# Verify that it now points to the Xcode tools.
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

If "-r" doesn't do the right thing, I think you can also set the path
manually:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Then run "bazel clean --expunge" once so that it picks up the new toolchain.


On Wed, Apr 25, 2018 at 9:52 PM Janak Ramakrishnan <jan...@google.com>
wrote:

Janak Ramakrishnan

unread,
Apr 25, 2018, 5:28:16 PM4/25/18
to Philipp Wollermann, Marcel Hlopko, László Csomor, bazel-discuss, Christopher Parsons, Peter Schmitt
That works, thanks! I think it was probably installed before.
On Wed, Apr 25, 2018 at 8:01 PM Philipp Wollermann <phi...@google.com>
Reply all
Reply to author
Forward
0 new messages