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

Use the target triple from the C++ toolchain instead of deriving it from values in the Apple configuration fragment. #768

Conversation

thii
Copy link
Member

@thii thii commented Feb 24, 2022

When using --host_cpu=darwin_x86_64 on an ARM (Apple Silicon) host, the value returned by the Apple configuration fragment is wrong, and we end up compiling Swift for arm64. Since the C++ toolchain already has the correct triple verbatim as we want it in the target_gnu_system_name field, just use that, and add some generally useful utilities for manipulating the triples and their components.

Note to open-source rules maintainers: This change requires/assumes that your C++ toolchain configuration returns a complete target triple that includes minimum OS version and target environment; for example, x86_64-apple-ios13.0-simulator.

PiperOrigin-RevId: 429897884
(cherry picked from commit 62b33ed)

…rom values in the Apple configuration fragment.

When using `--host_cpu=darwin_x86_64` on an ARM (Apple Silicon) host, the value returned by the Apple configuration fragment is wrong, and we end up compiling Swift for `arm64`. Since the C++ toolchain already has the correct triple verbatim as we want it in the `target_gnu_system_name` field, just use that, and add some generally useful utilities for manipulating the triples and their components.

Note to open-source rules maintainers: This change requires/assumes that your C++ toolchain configuration returns a complete target triple that includes minimum OS version and target environment; for example, `x86_64-apple-ios13.0-simulator`.

PiperOrigin-RevId: 429897884

(cherry picked from commit 62b33ed)
@thii thii force-pushed the use-the-target-triple-from-the-c-toolchain-instead-of-deriving-it-from-values-in-the-apple-configuration-fragment branch from a4019d5 to 5286ff9 Compare February 24, 2022 06:07
thii referenced this pull request Feb 24, 2022
…rom values in the Apple configuration fragment.

When using `--host_cpu=darwin_x86_64` on an ARM (Apple Silicon) host, the value returned by the Apple configuration fragment is wrong, and we end up compiling Swift for `arm64`. Since the C++ toolchain already has the correct triple verbatim as we want it in the `target_gnu_system_name` field, just use that, and add some generally useful utilities for manipulating the triples and their components.

Note to open-source rules maintainers: This change requires/assumes that your C++ toolchain configuration returns a complete target triple that includes minimum OS version and target environment; for example, `x86_64-apple-ios13.0-simulator`.

PiperOrigin-RevId: 429897884
@thii
Copy link
Member Author

thii commented Feb 24, 2022

thii added a commit to thii/bazel that referenced this pull request Feb 24, 2022
includes minimum OS version and target environment

This is required for bazelbuild/rules_swift#768
bazel-io pushed a commit to bazelbuild/bazel that referenced this pull request Mar 28, 2022
…ludes minimum OS version and target environment

This is required for bazelbuild/rules_swift#768

Closes #14898.

PiperOrigin-RevId: 437770046
thii added a commit to thii/bazel that referenced this pull request Apr 15, 2022
…ludes minimum OS version and target environment

This is required for bazelbuild/rules_swift#768

Closes bazelbuild#14898.

PiperOrigin-RevId: 437770046
(cherry picked from commit 3442179)
thii added a commit to thii/bazel that referenced this pull request Apr 18, 2022
…ludes minimum OS version and target environment

This is required for bazelbuild/rules_swift#768

Closes bazelbuild#14898.

PiperOrigin-RevId: 437770046
(cherry picked from commit 3442179)
ckolli5 pushed a commit to bazelbuild/bazel that referenced this pull request May 9, 2022
…ludes minimum OS version and target environment (#15266)

This is required for bazelbuild/rules_swift#768

Closes #14898.

PiperOrigin-RevId: 437770046
(cherry picked from commit 3442179)
@keith
Copy link
Member

keith commented Jul 7, 2022

ah i missed this and took a stab too, #858 we can take yours though, looks like all the linked stuff is at least in 5.2?

@thii
Copy link
Member Author

thii commented Jul 7, 2022

Either one is fine. I'm not near a computer in the next few days to rebase this so I guess just take yours?

@keith
Copy link
Member

keith commented Jul 7, 2022

ok merged that one

@keith keith closed this Jul 7, 2022
@thii thii deleted the use-the-target-triple-from-the-c-toolchain-instead-of-deriving-it-from-values-in-the-apple-configuration-fragment branch July 7, 2022 20:47
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.

3 participants