-
Notifications
You must be signed in to change notification settings - Fork 140
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
Configure LLVM cc_toolchain included with Swift releases #1113
base: master
Are you sure you want to change the base?
Conversation
e1402a4
to
36ad5aa
Compare
I think the general assumption today to solve this is by doing |
Yes, and this is the problem I'm trying to solve. You want to make sure There's even a
|
737b285
to
abde801
Compare
3570275
to
f0afe6e
Compare
I took this for a spin and I noticed that right now this works via using the old toolchain setup, which is a side effect of us not migrating to the new way sooner. Theoretically we should replace the If we make these changes this no longer works because the newly created toolchains here aren't registered. I think the ideal solution would be that we would create these toolchains as you are now, register them with the normal infra, and then bazel would discover them correctly. The potential problem with that is I think we need another constraint of some sort on the toolchain to make sure bazel picks the right one in that case, and I'm not sure if there's a way to do that while still calling configure_unix_toolchain. I noticed this because on macOS this change is actually a no-op for the wrong reasons, since we're using the new API already
|
bf4fc61
to
0618c50
Compare
On Linux, and to some extent on macOS, Swift ships with its own version of
clang
.Our problem: we have a tree with a lot of targets for different platforms, and we need to make sure that Swift built binaries are using the Apple-shipped
clang
if we decide to configure another default C++ toolchain for the rest of the build.This is currently not possible, because
rules_swift
assumes the use of@bazel_tools//tools/cpp:toolchain_type
for itscc_toolchain
.@local_config_apple_cc//:toolchain
clang
provided by Apple from https://www.swift.org/download/. Fortunately, the relevant functions are part of the public API of@bazel_tools
.@bazel_tools
.This means that we can remove the check for
CC=clang
entirely and leave this choice to the user (which they might need if they have native code that only compiles with clang for example). It is also a prerequisite for downloading Swift toolchains (except on macOS) directly in Bazel, which should now be possible.