cross compilation

hi

i want create a commande line tool for arm64 et intel x86-64

Xcode 16 macbook pro M3

my setting :

and

but my application compile only for arm64

who can explain to me ?

Answered by DTS Engineer in 812111022

OK, let’s take a step back. Why are you trying to build all of these architectures? In general, you only want to build x86_64 and arm64. And you almost never want to build arm64 and arm64e [1].

If you’re using Xcode then, by default, it’ll build both of the support architectures for a release build. Do this:

  1. Create a new project from the macOS > Command-Line Tool template.

  2. Choose Product > Archive.

  3. In the Xcode organiser, control click on that archive and choose Show in Finder.

  4. Open a Terminal window and change to that .xcarchive directory.

  5. Run file against the resulting tool:

% file Products/usr/local/bin/Test767593 
…/Test767593: Mach-O universal binary with 2 architectures: …
…/Test767593 (for architecture x86_64):	Mach-O 64-bit executable x86_64
…/Test767593 (for architecture arm64):	Mach-O 64-bit executable arm64

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Apple doesn’t guarantee binary compatibility for arm64e, except in specific limited circumstances, so the only reason to build it is for testing, and if you’re just testing there’s no need for arm64 as well.

That's a debug build. It will only be built with your native architecture. Do an archive build and it will contain all architectures.

no its a release build

when i build a archive it's fail "Roxane.1 no such file or directory"

OK, let’s take a step back. Why are you trying to build all of these architectures? In general, you only want to build x86_64 and arm64. And you almost never want to build arm64 and arm64e [1].

If you’re using Xcode then, by default, it’ll build both of the support architectures for a release build. Do this:

  1. Create a new project from the macOS > Command-Line Tool template.

  2. Choose Product > Archive.

  3. In the Xcode organiser, control click on that archive and choose Show in Finder.

  4. Open a Terminal window and change to that .xcarchive directory.

  5. Run file against the resulting tool:

% file Products/usr/local/bin/Test767593 
…/Test767593: Mach-O universal binary with 2 architectures: …
…/Test767593 (for architecture x86_64):	Mach-O 64-bit executable x86_64
…/Test767593 (for architecture arm64):	Mach-O 64-bit executable arm64

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Apple doesn’t guarantee binary compatibility for arm64e, except in specific limited circumstances, so the only reason to build it is for testing, and if you’re just testing there’s no need for arm64 as well.

when i build a archive it's fail "Roxane.1 no such file or directory"

Something in your project is not configured correctly.

I recommend creating a new project, using the same name, but in a different location, from the template. Don't make any changes. Just build and test an archive build. Then you can just copy your existing code over to the new project.

Accepted Answer

hi

roxane.1 is very old documentation, simply delete reference and all is ok...

cross compilation
 
 
Q