-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Include CPU in darwin platform string #7062
Conversation
cc @philwo since you were mentioned on the TODO |
An alternative (or addition to this) could be to add bazel/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java Lines 55 to 56 in 0ccee07
I could also do what is done for Windows and return bazel/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java Lines 44 to 46 in 7c70d82
|
It looks like some other stuff also assumes it's just bazel/tools/cpp/lib_cc_configure.bzl Lines 180 to 181 in edf7375
darwin to MACOS_TARGET_CPUS but I'm still debugging the tests
|
I pushed a possible fix here, I'm not entirely sure this is the right option. Running this locally doesn't actually work but I believe it's because the tests invoke my globally installed bazel somehow, instead of the one that was just build, and therefore get the old |
Some considerations: As you mention above I don't think there is more than a single macOS identifier, all the supported machines run on an x86 64bit darwin. The fact that two values exist for the same purpose has historical reasons (people didn't agree on what was the "correct" one). I don't think supporting both is the way to go though, updating everything to just use one version seems saner. In any case, some tests appear to be failing on buildkite with your changes, please make sure that's green (go to "details" above, click on the failing pipeline (macOS JDK8), you can see the detailed test logs by going to that pipeline's "Artifacts" tab). |
Which one should I unify on though? Likely unifying on the current one would be easier. But either way removing one will be a breaking change I guess? Specifically this might break people who have config that selects on Darwin as the cpu? I was still debugging why the tests are failing, but now I'll wait for a decision here before fixing them.
…--
Keith Smiley
On Jan 14, 2019, at 06:58, aragos ***@***.***> wrote:
Some considerations: As you mention above I don't think there is more than a single macOS identifier, all the supported machines run on an x86 64bit darwin. The fact that two values exist for the same purpose has historical reasons (people didn't agree on what was the "correct" one). I don't think supporting both is the way to go though, updating everything to just use one version seems saner.
In any case, some tests appear to be failing on buildkite with your changes, please make sure that's green (go to "details" above, click on the failing pipeline (macOS JDK8), you can see the detailed test logs by going to that pipeline's "Artifacts" tab).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Bazel uses the CPU to determine the --apple_platform_type to build for in some cases. Previously on a macOS machine the CPU would be returned as just `darwin`, which isn't considered a valid macOS CPU, instead we should return what we support and include the architecture.
@trybka while working on this fix I'm hitting a new issue that @sergiocampama thinks you might be able to help with. This test: bazel/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java Lines 690 to 702 in 682a0d1
Fails on macOS with this change because of this conditional: bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java Lines 249 to 252 in 00d2050
Before my change So I have 2 questions:
|
@aragos I've updated this PR to only support |
@@ -284,7 +284,7 @@ def _is_linux(platform): | |||
return platform == "k8" | |||
|
|||
def _is_darwin(platform): | |||
return platform == "darwin" | |||
return platform.startswith("darwin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be able to change this to just darwin_x86_64
, I'm not entirely sure, but also if we eventually have to support a new darwin
, I assume this is what we'll want
It looks like the only failing test is the one I commented about above, so once we have a solution to that this should be green |
I've pushed one possible solution for the test failure I asked about above 7c16844 This commit separates the failing test for darwin and validates that it errors with that message in this case, instead of having just the warning |
I don't think we can accept this without going through incompatible flag. This can (and will) break existing code. Since we are planning to migrate C++ (and objc transitively) rules to platforms (https://www.bazel.build/roadmaps/cpp.html#c-rules-use-platforms-2019q1) I think the better course of action is to make https://source.bazel.build/bazel/+/5609d14ece35fc57084bb66161c7b579cd836c5e:tools/platforms/BUILD more robust, and force users to migrate only once. Wdyt? |
What do you mean by making that platform configuration more robust? |
Also I guess a non-breaking change we could make here instead would be to add |
I've submitted the |
By more robust I mean having enough constraint_values to express all reasonable cases. But I should first sync with @aragos because he has plans that involve |
Sounds good, I'm hoping we can merge the alternative fix here #7151 and then punt on this portion of it until it's a better time |
The other PR has landed, so the original core issue is fixed here. We can revisit this in the future |
This is an alternative solution to bazelbuild#7062 that is more backwards compatible Closes bazelbuild#7151. PiperOrigin-RevId: 230388622
This is an alternative solution to bazelbuild/bazel#7062 that is more backwards compatible Closes #7151. PiperOrigin-RevId: 230388622
Bazel uses the CPU to determine the --apple_platform_type to build for
in some cases. Previously on a macOS machine the CPU would be returned
as just
darwin
, which isn't considered a valid macOS CPU, instead weshould return what we support and include the architecture.