I realise this question was 11 months ago, but hopefully you found an answer.
For anyone else who comes across this, there's a ticket with some workarounds and comments: SR-13739
Post
Replies
Boosts
Views
Activity
This has been doing my head in for the last week.
I discovered that our CI was running in rosetta, which means in all child processes also running in rosetta. This included our final xcodebuild commands, which would then fail to run on an arm64 simulator.
From the Rosetta Documentation - https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment - there is the following note:
The system prevents you from mixing arm64 code and x86_64
code in the same process. Rosetta translation applies to an entire
process, including all code modules that the process loads dynamically.
I read this, but initially didn't realise this would apply to child processes, too.
The fix was to use the 'arch' command to force xcodebuild to run on arm64.
arch -arm64 xcodebuild ...
'arch' can also be run with no arguments to print the current environment (arm64 or i386 etc). You could then cater your pipeline to the different build environments.