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

Bazel 0.8.1: Build fails with "Xcode version must be specified to use an Apple CROSSTOOL" on OSX High Sierra #4314

Open
dpursehouse opened this issue Dec 16, 2017 · 12 comments

Comments

Projects
None yet
@dpursehouse
Copy link
Contributor

commented Dec 16, 2017

This is similar to #3063 but not quite the same so I'm adding a new issue rather than commenting on that one again. CC @c-parsons as you were asking me about it before.

While building gerrit, the build failed due to a 404 on one of the dependency downloads. Then, on subsequent builds it failed with Xcode version must be specified to use an Apple CROSSTOOL. It only succeeds (or rather, fails again but with the expected error) after cleaning.

  1. The initial failure caused by 404 when downloading jgit library (seems to have not propagated on maven central yet):
gerrit $ bazel build gerrit
............
ERROR: /Users/dpursehouse/git/gerrit/lib/jgit/org.eclipse.jgit/BUILD:3:1: no such package '@jgit_lib//jar': failed /usr/bin/python /Users/dpursehouse/git/gerrit/tools/download_file.py -o /private/var/tmp/_bazel_dpursehouse/af01e59a244d19667aa266607f080c5a/external/jgit_lib/jar/org.eclipse.jgit-4.9.2.201712150930-r.jar -u MAVEN_CENTRAL:/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar -v a3a2d1df793245ebfc7322db3c2b9828ee184850 --unsign: Download http://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar
curl: (22) The requested URL returned error: 404 Not Found
error using curl: Command '['curl', '--proxy-anyauth', '-ksSfLo', '/Users/dpursehouse/.gerritcodereview/buck-cache/downloaded-artifacts/org.eclipse.jgit-4.9.2.201712150930-r.jar-a3a2d1df793245ebfc7322db3c2b9828ee184850', 'http://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar']' returned non-zero exit status 22
 and referenced by '//lib/jgit/org.eclipse.jgit:jgit'
ERROR: Analysis of target '//:gerrit' failed; build aborted: Loading failed
INFO: Elapsed time: 8.959s
FAILED: Build did NOT complete successfully (68 packages loaded)
  1. Subsequent build fails with Xcode version ... error:
gerrit $ bazel build gerrit
ERROR: /private/var/tmp/_bazel_dpursehouse/af01e59a244d19667aa266607f080c5a/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
ERROR: Analysis of target '//:gerrit' failed; build aborted: Analysis of target '@local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
INFO: Elapsed time: 0.399s
FAILED: Build did NOT complete successfully (14 packages loaded)
    currently loading: gerrit-util-http ... (2 packages)
  1. Run it again and see that it still fails with the Xcode error:
gerrit $ bazel build gerrit
ERROR: /private/var/tmp/_bazel_dpursehouse/af01e59a244d19667aa266607f080c5a/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
ERROR: Analysis of target '//:gerrit' failed; build aborted: Analysis of target '@local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
INFO: Elapsed time: 0.183s
FAILED: Build did NOT complete successfully (0 packages loaded)
    currently loading: lib/lucene
  1. Clean and try again, then it fails with the original (and expected) error
gerrit $ bazel clean --expunge
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
gerrit $ bazel build gerrit
............
ERROR: /Users/dpursehouse/git/gerrit/lib/jgit/org.eclipse.jgit/BUILD:3:1: no such package '@jgit_lib//jar': failed /usr/bin/python /Users/dpursehouse/git/gerrit/tools/download_file.py -o /private/var/tmp/_bazel_dpursehouse/af01e59a244d19667aa266607f080c5a/external/jgit_lib/jar/org.eclipse.jgit-4.9.2.201712150930-r.jar -u MAVEN_CENTRAL:/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar -v a3a2d1df793245ebfc7322db3c2b9828ee184850 --unsign: Download http://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar
curl: (22) The requested URL returned error: 404 Not Found
error using curl: Command '['curl', '--proxy-anyauth', '-ksSfLo', '/Users/dpursehouse/.gerritcodereview/buck-cache/downloaded-artifacts/org.eclipse.jgit-4.9.2.201712150930-r.jar-a3a2d1df793245ebfc7322db3c2b9828ee184850', 'http://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit/4.9.2.201712150930-r/org.eclipse.jgit-4.9.2.201712150930-r.jar']' returned non-zero exit status 22
 and referenced by '//lib/jgit/org.eclipse.jgit:jgit'
ERROR: Analysis of target '//:gerrit' failed; build aborted: Loading failed
INFO: Elapsed time: 8.886s
FAILED: Build did NOT complete successfully (63 packages loaded)

OS: OSX High Sierra 10.13.2

@dpursehouse

This comment has been minimized.

Copy link
Contributor Author

commented Dec 16, 2017

gerrit $ bazel version
Build label: 0.8.1-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Dec 5 19:33:07 2017 (1512502387)
Build timestamp: 1512502387
Build timestamp as int: 1512502387
@dpursehouse

This comment has been minimized.

Copy link
Contributor Author

commented Dec 16, 2017

gerrit $ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
@aehlig

This comment has been minimized.

Copy link
Member

commented Dec 18, 2017

@c-parsons as you apparently asked for it, can you take care of triaging this issue? Thanks.

@dpursehouse

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

Note that the problem can't be reproduced with the exact steps mentioned above any more because that version of jgit is now available on maven. To induce the error, it should be possible to simply change the version to something else that doesn't exist.

@kishankarun

This comment has been minimized.

Copy link

commented Dec 22, 2017

I am facing the similar issue in windows 7.

I had installed bazel with chocolatey (even i had tried with bazel.exe also)

$ tools/eclipse/project.py

Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
ERROR: build interrupted
INFO: Elapsed time: 56.353s
FAILED: Build did NOT complete successfully (0 packages loaded)

Even bazel build

$ bazel build gerrit
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
ERROR: build interrupted
INFO: Elapsed time: 56.353s
FAILED: Build did NOT complete successfully (0 packages loaded)
$ java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
$ bazel version
Build label: 0.9.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Dec 19 09:32:04 2017 (1513675924)
Build timestamp: 1513675924
Build timestamp as int: 1513675924

@davido

This comment has been minimized.

Copy link
Contributor

commented Dec 22, 2017

@kishankarun Build of Gerrit Code Review on Windows is bleeding edge and work in progress. It doesn't work yet. I don't think your problem is related to this issue. You may want open a new issue, on Gerrit Code Review issue tracker and not here, as it's not Bazel related (probably).

I guess, that you current problem is workspace-status-command that is per default included and must be overwritten. It would also help, if you try to build a small part of gerrit (basic library) and not the whole world. So try this on Gerrit@HEAD:

  $ bazel build --workspace_status_command=tools/workspace-status.cmd --verbose_failures java/com/google/gerrit/common:server
@davidstanke

This comment has been minimized.

Copy link
Member

commented Jan 2, 2018

+1 - I just got this issue ("Xcode version must be specified to use an Apple CROSSTOOL") on macOS 10.12.6 Sierra, using Bazel 0.9.0 installed via Homebrew. It was fixed via bazel clean --expunge. (For the record, I'm building a very simple Java app, with a single local_repository external dep.)

@redisliu

This comment has been minimized.

Copy link

commented Mar 3, 2018

FYI: I encountered similar issue recently, which got fixed with:

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

@kishankarun

This comment has been minimized.

Copy link

commented Mar 5, 2018

Thanks, @davido, all

@aaaa0441

This comment has been minimized.

Copy link

commented Aug 31, 2018

@redisliu thanks for the solution. I am trying to build Angular. You saved my night. 👍

@lizebang

This comment has been minimized.

Copy link

commented Oct 25, 2018

@redisliu thanks a lot, good solution.

@gsagula

This comment has been minimized.

Copy link

commented Jun 13, 2019

@redisliu 👍 🥇

@gurezo gurezo referenced this issue Jul 2, 2019

Closed

build error #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.