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

Add toolchains to rules that use @bazel_tools//tools/cpp:toolchain_type #807

Conversation

mattrobmattrob
Copy link
Collaborator

@mattrobmattrob mattrobmattrob commented Nov 10, 2023

Fix the following from #795:

Error in fail: In order to use find_cpp_toolchain, you must include the '@bazel_tools//tools/cpp:toolchain_type' in the toolchains argument to your rule.

…_type`

Signed-off-by: Matt Robinson <mattrob@hey.com>
@mattrobmattrob mattrobmattrob marked this pull request as ready for review November 10, 2023 18:00
@mattrobmattrob mattrobmattrob requested review from luispadron and thiagohmcruz and removed request for luispadron November 10, 2023 18:13
@@ -1191,6 +1191,7 @@ def _apple_framework_packaging_impl(ctx):

apple_framework_packaging = rule(
implementation = _apple_framework_packaging_impl,
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Any downsides or fallout from adding this? I wondered if we need to add it to other rules; hmap, middlemen, etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know of any. But I still haven't narrowed down the reasons for 👇 when using Bazel 7 with this change (like in #797):

clang: error: using sysroot for 'AppleTVSimulator' but targeting 'MacOSX' [-Werror,-Wincompatible-sysroot]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated but should we delete this file in a follow-up, it appears to be unused.

Copy link
Collaborator

@luispadron luispadron left a comment

Choose a reason for hiding this comment

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

I wonder if this has to do with the move to apple_support toolchain

The Apple CC toolchain in this repository provides toolchains for building for Apple platforms besides macOS. Since Bazel 7 this toolchain is required when targeting those platforms but the toolchain also supports Bazel 6.

https://github.com/bazelbuild/apple_support#toolchain-setup

@mattrobmattrob
Copy link
Collaborator Author

Given the discussion in https://bazelbuild.slack.com/archives/CD3QY5C2X/p1701890904270059, I'm less worried about the sysroot issue. Let's merge this and we can revert if there are problems.

@mattrobmattrob mattrobmattrob merged commit ca2c2ac into bazel-ios:master Dec 7, 2023
@mattrobmattrob mattrobmattrob deleted the mr/bazel7/add.toolchains.when.necessary branch December 7, 2023 14:15
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.

4 participants