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

Remove templating of osx crosstool #7882

Closed
wants to merge 2 commits into from

Conversation

keith
Copy link
Member

@keith keith commented Mar 28, 2019

Previously this file was templated so that
cxx_builtin_include_directories could be set on each machine. For macOS
the only paths you should need here are ones to Xcode, which with this
change would be required to live in /Applications. This mirrors the
behavior of Google's internal crosstool.


Args:
repository_ctx: The repository context.
cc: The default C++ compiler on the local system.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this ever be a cc from a locally built toolchain? For example if I build clang locally and want to use that, it seems that this change prevents me from doing that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Also, clang could be installed in /Library/Developer/CommandLineTools which isn't covered by this new stricter check.

@jin jin added the z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple label Mar 29, 2019
Copy link
Contributor

@aragos aragos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides removing some complexity, does this change actually fix a problem? Because the logic exists for a reason and removing it should be traded off for some better value.


Args:
repository_ctx: The repository context.
cc: The default C++ compiler on the local system.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Also, clang could be installed in /Library/Developer/CommandLineTools which isn't covered by this new stricter check.

@keith
Copy link
Member Author

keith commented Apr 1, 2019

Thanks for the feedback. The reason I submitted this was:

  1. This is what the internal Google crosstool is doing, so if that works internally I didn't know why it wouldn't work externally. Changing to be more like it (I assume) should help them converge
  2. This removes a thing people need to think about for something like Add override point for cc_autoconf #7883

Also, clang could be installed in /Library/Developer/CommandLineTools which isn't covered by this new stricter check.

If this is the only place clang is installed, I believe this will end up going through the unix setup, which appears to whitelist / for this same field:

elif (ctx.attr.cpu == "darwin"):
cxx_builtin_include_directories = ["/"]

(although I'm not sure why this file and https://github.com/bazelbuild/bazel/blob/716e19c77154cec4daa32e33a4310cac07d31a00/tools/cpp/cc_toolchain_config.bzl.tpl exist so maybe this isn't the case)

Should we do that instead?

@keith
Copy link
Member Author

keith commented Apr 8, 2019

@aragos any thoughts?

@aragos aragos requested a review from trybka April 12, 2019 20:52
@aragos
Copy link
Contributor

aragos commented Apr 12, 2019

Added @trybka as I think he's working in the same space and may be submitting a change accomplishing something similar to yours.

@trybka
Copy link
Contributor

trybka commented Apr 16, 2019

Is it actually reasonable to expect external users to always have Xcode under /Applications?

One of the most common complaints we get is when users have it under /Users/Me/Applications.

Of course, internally we can mandate that they move it. But can we force the same thing externally?

(This is a question for the Bazel folks) @aragos

@aragos
Copy link
Contributor

aragos commented Apr 16, 2019

I don't have a strong opinion on restricting the directories to /Applications/. Honestly I don't feel like the extra safety is worth the trouble. The only thing that would make sense is to first detect installed xcodes and then use their known locations - but that would go out of date and put us into similar unhappy situations as with xcode_locator so let's not do that.

@keith
Copy link
Member Author

keith commented Apr 17, 2019

@aragos updated!

@aragos aragos assigned keith and unassigned trybka Apr 19, 2019
@aragos
Copy link
Contributor

aragos commented Apr 19, 2019

As you can see above this change fails some tests. Please address the failures and then I'll import it.

@keith
Copy link
Member Author

keith commented Apr 19, 2019

Both of these tests are failing because they expected a build failure because of these paths being invalidated. Which I guess means it wasn't checking this codepath https://github.com/keith/bazel/blob/59254f64fba89c822543c347669b538177cd35f8/tools/cpp/cc_toolchain_config.bzl#L1202-L1203 do you have a recommendation for a solution to them?

@aragos
Copy link
Contributor

aragos commented Apr 19, 2019

This test fails as expected:

self.AssertExitCode(exit_code, 1, stderr)
- you've made it legal for all files on the filesystem to be included, regardless of whether they're declared as an input or not. That's the tradeoff we chose to make all possible Xcode locations valid. The test will have to be skipped for darwin builds as a result (although I'm not sure how to do that within the python integration test framework, you'll have to find out).

Not sure why this failure is happening, it may be unrelated to your change (or not :): http://go/gh/bazelbuild/bazel/blob/0b03a28701d297c9ffe976c54580ceff32eec1b7/src/test/shell/bazel/cc_integration_test.sh#L106, further investigation/rerun is needed.

Previously this file was templated so that
cxx_builtin_include_directories could be set on each machine. For macOS
the only paths you should need here are ones to Xcode, which with this
change would be required to live in `/Applications`. This mirrors the
behavior of Google's internal crosstool.
@keith
Copy link
Member Author

keith commented Apr 19, 2019

I've opted out of that test, we'll see if the other one fails again

@keith
Copy link
Member Author

keith commented Apr 19, 2019

@hlopko since you added the test that's failing here can you help me understand if this is still an issue with this change?

@keith
Copy link
Member Author

keith commented May 3, 2019

@hlopko friendly ping

@keith
Copy link
Member Author

keith commented Jun 26, 2019

This was done in a different way here ac3d06b

It's still using the previous include dirs, so if we'd prefer / like what Google uses it could still be a follow up. But given the non-response here I'm going to close anyways.

@keith keith closed this Jun 26, 2019
@keith keith deleted the ks/applications-only branch June 26, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants