Compatibility issue between binaries compiled on M2 and i5

Mac OSX specific forum
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 799
Joined: Fri Dec 04, 2015 9:26 pm

Compatibility issue between binaries compiled on M2 and i5

Post by skinkairewalker »

Hi everyone,
I’m running into a strange compatibility issue with executables built using PureBasic on macOS.
I created an app on my MacBook Air i5 (Intel), and it runs perfectly both on that machine and on a MacBook Air M2 (Apple Silicon).
However, when I do the opposite — compile the same code on the M2 and try to run it on the MacBook Air i5 — I get the following error message:
“This application is not compatible with this type of Mac.”
It seems that the binary built on the M2 is ARM64-only, and the Intel Mac cannot execute it.

Does anyone know how to build a universal binary (Intel + Apple Silicon) with PureBasic on macOS?
Is there any compiler flag or setting to generate both architectures?
Any help or workaround would be greatly appreciated! 🙏

System Info:
PureBasic (version 6.30B2)

MacBook Air i5 (Intel) with macOS Monterey 12.7.6
MacBook Air M2 (ARM64) with Tahoe 26.0.1
User avatar
mk-soft
Always Here
Always Here
Posts: 6286
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Compatibility issue between binaries compiled on M2 and i5

Post by mk-soft »

I don't have an M2 Mac, but you would also have to install the PB version for Intel and the command line tools for Intel.
Then there is an Xcode Tool to combine both programs in one app. Been here in the forum, but can't find it again.

I don't know exactly how to do that.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 474
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: Compatibility issue between binaries compiled on M2 and i5

Post by Mindphazer »

MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Piero
Addict
Addict
Posts: 1025
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Compatibility issue between binaries compiled on M2 and i5

Post by Piero »

User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 799
Joined: Fri Dec 04, 2015 9:26 pm

Re: Compatibility issue between binaries compiled on M2 and i5

Post by skinkairewalker »

houldn't there be an option directly in the compiler? To generate the MacOS Universal executable?
mrbungle
Enthusiast
Enthusiast
Posts: 161
Joined: Wed Dec 30, 2020 3:18 am

Re: Compatibility issue between binaries compiled on M2 and i5

Post by mrbungle »

I run two separate instances of PB Compilers. With Rosstta, you can run the Intel version.

I then compile two versions of the app and then generate a universal binary using the lipo command.
Post Reply