What is involved in compiling 32-bit Intel OS X binaries on a 64-bit command-line environment? Is it as simple as adding a -m32
flag? I'm not using Xcode, but could use it to install libraries that gcc
could use, if needed. Thanks for your advice.
Asked
Active
Viewed 8,270 times
6

Alex Reynolds
- 95,983
- 54
- 240
- 345
1 Answers
8
If you're compiling on a Macintosh computer using Apple's implementation of GCC, one of the extra options you can pass along is the "-arch
" parameter.
The man page says this:
-arch arch
Compile for the specified target architecture arch.
The allowable values are i386, x86_64, ppc and ppc64.
Multiple options work, and direct the compiler to produce "universal"
binaries including object code for each architecture specified with -arch.
This option only works if assembler and libraries are available
for each architecture specified. (APPLE ONLY)

Michael Dautermann
- 88,797
- 17
- 166
- 215
-
Is `i386` always (and I mean always) 32-bit Intel? – Alex Reynolds Dec 08 '12 at 16:30
-
AFAIK... unless AMD or some other Intel competitor I didn't know about are making chips for Apple computers. – Michael Dautermann Dec 08 '12 at 16:32
-
Okay, I'll give that a shot and see what I can find. Thanks. – Alex Reynolds Dec 08 '12 at 16:32
-
Please update the link for "The man page". – Boris Sep 10 '21 at 17:20
-
1done @Boris ; gcc doesn't ship by default on Macs anymore, IIRC. [OpenSource contributors are still "working on it" for M1 macs](https://discussions.apple.com/thread/252398918). – Michael Dautermann Sep 10 '21 at 23:04
-
@MichaelDautermann Correct. `gcc` with macOS is actually `clang` unfortunately. – Pryftan Mar 23 '23 at 16:00