-
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
Swift host tools compiled with wrong cpu on Apple Silicon #12671
Comments
Looks like the cpu we use for the triple comes from the apple fragment: |
Seems like the issue is coming from here bazel/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java Lines 99 to 101 in 92a9e2f
|
It makes sense to me that you building directly with |
Getting the same result with |
I'm not sure how host_cpu works for the apple configuration so I'm not sure if that makes a difference
|
cc_binary tools work because they're not being passed a |
I think we need to fix this in bazel itself otherwise I imagine many other things will also be incorrect |
This is actually probably the same case as if you try to build for the simulator on a apple silicon machine, it will build a x86_64 simulator binary, I assume the fix for both will be similar |
Our current workaround is invoking the tool with |
@susinmotion can you move this issue to the bazel repo? |
I'm afraid I don't have permissions in rules_swift, so I can't see the option to move this issue. @allevato, any chance you have permissions to transfer this issue? |
@susinmotion Transferred! |
cc: @susinmotion |
With Apple Silicon machines host tools that use the apple_binary, or apple fragment to fetch the CPU would be built for the wrong architecture, even though the C++ logic would correctly identify the host CPU. This changes this hardcoded value to correctly determine Apple Silicon as arm64, and otherwise fallback to x86_64. Fixes bazelbuild#12671
With Apple Silicon machines host tools that use the apple_binary, or apple fragment to fetch the CPU would be built for the wrong architecture, even though the C++ logic would correctly identify the host CPU. This changes this hardcoded value to correctly determine Apple Silicon as arm64, and otherwise fallback to x86_64. Fixes #12671 Closes #13440. PiperOrigin-RevId: 373421791
With Apple Silicon machines host tools that use the apple_binary, or apple fragment to fetch the CPU would be built for the wrong architecture, even though the C++ logic would correctly identify the host CPU. This changes this hardcoded value to correctly determine Apple Silicon as arm64, and otherwise fallback to x86_64. Fixes bazelbuild#12671 Closes bazelbuild#13440. PiperOrigin-RevId: 373421791
With Apple Silicon machines host tools that use the apple_binary, or apple fragment to fetch the CPU would be built for the wrong architecture, even though the C++ logic would correctly identify the host CPU. This changes this hardcoded value to correctly determine Apple Silicon as arm64, and otherwise fallback to x86_64. Fixes bazelbuild#12671 Closes bazelbuild#13440. PiperOrigin-RevId: 373421791
Host tools are being compiled for
x86_64
cpu when compiling a target that uses them on an arm Mac, with an arm Bazel.It works fine if we build the tool directly with
--macos_cpus=arm64
.Tools written in C/C++ work fine.
I'm using a custom build for darwin arm64 at https://github.com/thii/bazel/tree/4.0.0-darwin_arm64 (based on 4.0.0rc2), so there’s a possibility that it’s a problem with my build.
The text was updated successfully, but these errors were encountered: