Universal Binaries for Mac OS

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
cxAlex
User
User
Posts: 88
Joined: Fri Oct 24, 2008 11:29 pm
Location: Austria
Contact:

Universal Binaries for Mac OS

Post by cxAlex »

I'd like a Feature to build Universal Binaries which would work on x86 and PowerPC based Mac.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

You can already create universal binaries from PB. Just compile your code once with the x86 and once with the ppc version and then use the "lipo" commandline tool to combine the two executables into one universal binary.

There is also a tool here, never tested it though: http://www.purebasic.fr/english/viewtopic.php?t=36678

I don't think adding a direct IDE option for this is such a good idea because the x86 and ppc compilers have some differences (no quad or double support on ppc, also there is a limit on procedure parameters). If people just blindly select "universal binary" as output and never test the ppc side of that binary, they will most likely end up with a broken program on ppc Macs.

So better compile the ppc version separately and also test it separately (can be done with Rosetta), and only combine them to a universal binary once you know they both work as expected.
quidquid Latine dictum sit altum videtur
User avatar
tikidays
User
User
Posts: 46
Joined: Tue Oct 24, 2023 6:47 am
Location: New Zealand
Contact:

Re: Universal Binaries for Mac OS

Post by tikidays »

Why is there a compile option for "Any CPU" if it doesn't compile for Intel and ARM? Is this a prep thing?
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Universal Binaries for Mac OS

Post by mk-soft »

For Any Intel CPU (SSE, etc) for user libraries ...
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
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Universal Binaries for Mac OS

Post by jacdelad »

tikidays wrote: Sun Jan 28, 2024 6:16 pm Why is there a compile option for "Any CPU" if it doesn't compile for Intel and ARM? Is this a prep thing?
Before asking in the forum, you should read the help:
Cpu Optimisation (next to Executable format)
This setting allows to include Cpu optimised PB functions in your executable:
All CPU : The generic functions are included that run on all CPUs.
Dynamic CPU : The generic functions as well as any available CPU specific function are included. The function to execute is decided at runtime. This creates a bigger executable, but it will run as fast as possible on all CPUs.
All other options : Include only the functions for a specific CPU. The executable will not run on any Cpu that does not support this feature.

Note: No PB functions actually support this feature for now (it is ignored for them). However, some User Libraries include such optimisations.
https://www.purebasic.com/documentation ... piler.html
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Post Reply