UE5 - Building shipping package on Mac M1 for Intel architecture

Talad
Tue, 28 Feb 2023 13:08:15 +0000
Platform & Builds

Hi,
similarly to the other thread I created for UE4 (which at the end works), I’m now creating this thread for UE5, as I’ve upgraded my project and I cannot find a way to package for Intel Architecture on M1 chip.

I migrated my project to UE5, and building shipping on windows and linux worked fine. I’m stuck on Mac as it is always creating a ARM64 executable.

I tried the following, incrementally.

1. Start a new shell with arch x86_64:
$env /usr/bin/arch -x86_64 /bin/zsh --login

2. Set valid architectures in environment:

export ARCHS=x86_64
export VALID_ARCHS=x86_64

3. Pass the -architecture flag to the build command:

-architecture=x86_64

My current build command is:

/Users/luke/5.1.1-release/Engine/Build/BatchFiles/RunUAT.command BuildCookRun -project=“/Users/luke/PSUnreal511/PSUnreal.uproject” -nop4 -Prereqs -package -target=PSUnrealClient -clientconfig=Shipping -utf8output -platform=Mac -architecture=x86_64 -targetplatform=Mac -build -cook -allmaps -pak -stage -archive -archivedirectory=“/Users/luke/temp/PSUnreal_Ship”

4. Modify the Unreal Engine Xcode Settings and my project Xcode settings to have only Intel 64 architecture listed as available target platforms.

With all of the above, I still get an M1 executable for my project. I verify that with “file” command.

UnrealEditor is actually a x86_64:

luke@Lucas-Mac-mini Scripts % file ~/5.1.1-release/Engine/Binaries/Mac/UnrealEditor.app/Contents/MacOS/UnrealEditor
/Users/luke/5.1.1-release/Engine/Binaries/Mac/UnrealEditor.app/Contents/MacOS/UnrealEditor: Mach-O 64-bit executable x86_64

But my project is arm64:

luke@Lucas-Mac-mini Scripts % file ~/temp/PSUnreal_Ship/MacClient/PSUnrealClient.app/Contents/MacOS/PSUnrealClient
/Users/luke/temp/PSUnreal_Ship/MacClient/PSUnrealClient.app/Contents/MacOS/PSUnrealClient: Mach-O 64-bit executable arm64

In the logs I see this:

********** BUILD COMMAND STARTED **********
Building PSUnrealClientEditor as x86_64 (arm64 not currently supported)
Building UnrealHeaderTool as arm64 for host
Building UnrealHeaderTool as arm64 for host
Building ShaderCompileWorker as arm64 for host
Building UnrealPak as arm64 for host
Building PSUnrealClient as arm64 for local non-distribution

As you can see the last line says it is building arm64.

then it starts to rebuild the whole engine

Building 1548 actions with 1 process…
[1/1548] Link UnrealEditor-Core.dylib

then it compiles my project, but on the log I see it’s passing the -architecture=arm64 which I didn’t specify.

Does anyone know how to control this?

6 posts - 3 participants