Creating Universal Binaries with XCode Tools

Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
The XCode tools install the gcc compiler, which seems to be the C/C++ compiler that is used on the Mac. Is there a way to make this compiler and associated tool chain produce universal binaries? I know from past Linux experience that gcc has a gazillion options. Before I start digging into them, I was wondering whether anyone could point me at a simple reference that would explain how to use these tools to create universal binaries.

In this case, I am just building ncurses-based Terminal.app applications, but I would like them to be compatible with both PPC and Intel Macs. Thanks.
 
L

Logan

Guest
Scanning over it seems the major factor is that bytes and variable handling are of different sizes depending on architexture.

Boolean is 1 byte on x86 machines, 4 bytes on PPC

A long double is 16 bytes on both architectures, but only 80 bits are significant in long double data types on Intel-based Macintosh computers.

there's just a ton of really simple yet potentially tedius tweaks, and from what I scanned over it appears that when your code is universal binary ready, you'll know just simply after compiling on a universal binary-compatible machine by going to get info and looking at the application's type.

Be sure you're using the latest compiler too. :p
 
OP
mac57
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
Sounds like gcc 4.0 builds universal binaries by default. I will have to check into this I guess. Thanks for the pointers!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top