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

Fix build breakage on macOS when XCode is not installed. #223

Merged
merged 3 commits into from
May 1, 2018

Conversation

judah
Copy link
Collaborator

@judah judah commented Apr 30, 2018

If the macOS "command-line developer tools" are installed, but XCode
is not, then Bazel will make ar_executable point to /usr/bin/libtool
(despite the fact that ar and libtool are not invoked the same way).
https://github.com/bazelbuild/bazel/blob/71932dd4e25d5e755cb8ce12f4dece438c4b5cb1/tools/cpp/unix_cc_configure.bzl#L101

Fix it by checking for that case and overriding it to point to /usr/bin/ar
(which is a path also hard-coded in the above code). This is not ideal, but I don't
know a good way around it.

Note that rules_rust has done a similar workaround:
https://github.com/bazelbuild/rules_rust/blob/df95c3e3cd5afd87a69fa71dc9a56a0d0baa7823/rust/toolchain.bzl#L18

Filed an upstream bug: bazelbuild/bazel#5127

If the macOS "command-line developer tools" are installed, but XCode
is not, then Bazel will make `ar_executable` point to `/usr/bin/libtool`
(despite the fact that `ar` and `libtool` are not invoked the same way).
https://github.com/bazelbuild/bazel/blob/71932dd4e25d5e755cb8ce12f4dece438c4b5cb1/tools/cpp/unix_cc_configure.bzl#L101

Fix it by checking for that case and overriding it to point to `/usr/bin/ar`
(which is a path also hard-coded in the above code).  This is not ideal, but I don't
know a good way around it.

Note that `rules_rust` has done a similar workaround:
https://github.com/bazelbuild/rules_rust/blob/df95c3e3cd5afd87a69fa71dc9a56a0d0baa7823/rust/toolchain.bzl#L18
@mboes
Copy link
Member

mboes commented May 1, 2018

Is there an upstream ticket for this Bazel misfeature, one that you could point to in the comment?

@mboes mboes merged commit 63cb07e into tweag:master May 1, 2018
@judah judah deleted the libtool-is-not-ar branch May 1, 2018 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants