I’m trying to build a universal version of a plugin using xcodebuild and Projucer 7.0.9. The output when I run xcode build is:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Builds/MacOSX/Perspective.xcodeproj -scheme “Perspective - All” -c— xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:8BD34136-9ED7-5930-A2D6-A78A5ADCA922, name:My Mac }
{ platform:macOS, name:Any Mac }
… and the build ends up being whatever architecture is active when the build is started. If I build on an M1 with a terminal running in native mode, I get an arm64 build. If I build running in Rosetta mode, I get x86_64 at the build.
I have tried a variety of settings in Projucer, xcode and xcodebuild with no luck. My build script runs projucer to set the version before calling xcodebuild with the following parameters:
Since Xcode 15.3 you can override architecture built in Scheme.
The default option is Match Run Destination which override the fact that you have set universal binary
After much hassle with this myself, I have adopted a strategy of using VM’s for any older MacOS versions I want to target, and maintain a small suite of these for the purpose. Its the only way to be sure you don’t get backlogged, just because Apple have decided to apply an antipattern designed to make people upgrade their hardware …
Is there some way to set this in the Projucer so that it builds all architectures? I’m building a plugin via Github Actions and creating the XCode project from the Projucer so it isn’t easy for me to select ‘Any Mac’ just before building.
I discovered this by sending my (supposedly) universal binary to someone who couldn’t run it, built from a project that previously produced universal binaries. I expect others will have this same issue.
If multiple architectures builds are important to you, you must emmigrate away from the Projucer and convert to a CMake-based project, instead. The investment made in doing this is worth far more than the ‘comfort’ in staying on Projucer-based projects. Projucer is great for getting started - for production, CMake is far, far superior.
This is the most effective way to handle cross-platform, multi-architecture build strategies - and then, when you get it working, to save yourself immense pain as time moves on, move the CMake project into VM’s for each OS target.
Hey, I’m running into a similar issue. Everything works fine when I build it on my Mac, but when I try to build it for any Mac (for distribution), mbedtls throws an error because I don’t have the ARM version installed on my computer. Is there any way to compile the ARM version on my machine or get it compiled?
@zsilu98 Did you manage to get it running on ARM?
Also, do I even need to compile it manually for that? Or is there a prebuilt version I can use somehow?