Skip to content

Conversation

@wcandillon
Copy link
Contributor

My apologies for this AI-generated PR. I am the maintainer of https://github.com/wcandillon/react-native-webgpu and we've always relied on ios-cmake for our CMake builds. It has been tremendously helpful. This AI-generated change helped us fix our macOS build. Below is the AI-generated description of the change:

  ## Problem
  When building for `MAC_UNIVERSAL` platform, CMake fails with the error:
  clang: error: version 'arm64' in target triple 'arm64-apple-macosx11.0-arm64' is invalid

  This occurs because the toolchain generates an invalid target triple `x86_64-arm64-apple-macosx11.0` by combining multiple architectures with dashes, which clang cannot parse.

  ## Root Cause
  The `MAC_UNIVERSAL` configuration was setting `APPLE_TARGET_TRIPLE_INT` to `${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}` where `ARCHS_SPLIT` becomes `x86_64-arm64`. This creates an invalid target triple format that clang rejects.

  ## Solution
  Remove the target triple setting for `MAC_UNIVERSAL` builds and let CMake handle the universal build using the standard `-arch x86_64 -arch arm64` approach. This follows the same pattern used by other COMBINED builds in the toolchain.

  Universal builds should rely on the `-arch` flags rather than target triples, as:
  - Target triples are meant for single architectures
  - Universal builds are handled at the linker level by combining object files from different architectures
  - CMake's built-in universal build support works correctly without explicit target triples

My apologies for this AI-generated PR. I am the maintainer of https://github.com/wcandillon/react-native-webgpu and we've always relied on ios-cmake for our CMake builds. It has been tremendously helpful. This AI-generated change helped us fix our macOS build.
Below is the AI-generated description of the change:
```
  ## Problem
  When building for `MAC_UNIVERSAL` platform, CMake fails with the error:
  clang: error: version 'arm64' in target triple 'arm64-apple-macosx11.0-arm64' is invalid

  This occurs because the toolchain generates an invalid target triple `x86_64-arm64-apple-macosx11.0` by combining multiple architectures with dashes, which clang cannot parse.

  ## Root Cause
  The `MAC_UNIVERSAL` configuration was setting `APPLE_TARGET_TRIPLE_INT` to `${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}` where `ARCHS_SPLIT` becomes `x86_64-arm64`. This creates an invalid target triple format that clang rejects.

  ## Solution
  Remove the target triple setting for `MAC_UNIVERSAL` builds and let CMake handle the universal build using the standard `-arch x86_64 -arch arm64` approach. This follows the same pattern used by other COMBINED builds in the toolchain.

  Universal builds should rely on the `-arch` flags rather than target triples, as:
  - Target triples are meant for single architectures
  - Universal builds are handled at the linker level by combining object files from different architectures
  - CMake's built-in universal build support works correctly without explicit target triples
```
@oliverepper
Copy link
Contributor

Works for us, too! Thanks @wcandillon

@leetal leetal self-requested a review July 22, 2025 15:05
@leetal leetal closed this Jul 22, 2025
@leetal
Copy link
Owner

leetal commented Jul 22, 2025

Closed since the same logic was added in another PR.

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