List of valid targets for --target argument in Windows Metal tools

Currently trying to figure out why our translated HLSL is failing to be able to create a .metallib. The error is:

LLVM ERROR: Error opening 'C:\Program Files\Metal Developer Tools\iOS\bin\..\lib\clang\31001.630\lib\darwin\libmetal_rt_osx.a': no such file or directory!

I'm invoking metal and metallib from the ios subfolder of the Windows tools, so my guess is that I also need to invoke metal with the --target argument to inform it that it is in fact an iOS target, but I have no idea where to find what the valid list of these is.

Accepted Reply

Yes, you do need to specify the -target option like this: -target air64-apple-ios16.0.

The full syntax for specifying the target triple can be found at https://clang.llvm.org/docs/CrossCompilation.html but for our purposes you can break it down as <arch>-<vendor>-<minimum deployment target>. air64 must be the architecture and apple must be the vendor. The OS that we support are: ios, tvos (with the iOS toolchain in the ios subfolder) and macos (with the macOS toolchain in the macos subfolder).

Besides that you can also specify an environment in your triple with a suffix to the last part of the triple. The two environments that are supported are the Simulator (for which the suffix is -simulator) and MacCatalyst (for which the suffix is -macabi). For the simulator you'll need to use the iOS toolchain and for MacCatalyst you should use the MacOS toolchain (and specify the iOS deployment target.

Here are some examples of triples you can use with the -target option with the iOS toolchain:

-target air64-apple-ios16.0

-target air64-apple-tvos16.0

-target air64-apple-ios16.0-simulator

-target air64-apple-tvos16.0-simulator

Here are some examples of triples you can use with the -target option with the macOS toolchain:

-target air64-apple-macos13.0

-target air64-apple-ios16.0-macabi

Replies

Yes, you do need to specify the -target option like this: -target air64-apple-ios16.0.

The full syntax for specifying the target triple can be found at https://clang.llvm.org/docs/CrossCompilation.html but for our purposes you can break it down as <arch>-<vendor>-<minimum deployment target>. air64 must be the architecture and apple must be the vendor. The OS that we support are: ios, tvos (with the iOS toolchain in the ios subfolder) and macos (with the macOS toolchain in the macos subfolder).

Besides that you can also specify an environment in your triple with a suffix to the last part of the triple. The two environments that are supported are the Simulator (for which the suffix is -simulator) and MacCatalyst (for which the suffix is -macabi). For the simulator you'll need to use the iOS toolchain and for MacCatalyst you should use the MacOS toolchain (and specify the iOS deployment target.

Here are some examples of triples you can use with the -target option with the iOS toolchain:

-target air64-apple-ios16.0

-target air64-apple-tvos16.0

-target air64-apple-ios16.0-simulator

-target air64-apple-tvos16.0-simulator

Here are some examples of triples you can use with the -target option with the macOS toolchain:

-target air64-apple-macos13.0

-target air64-apple-ios16.0-macabi