I am building on a Mac OS X 10.8.2 workstation running GCC 4.7.2 obtained via MacPorts. I can build 64-bit (x86_64
) apps with this setup.
I am trying to build a 32-bit binary from source by adding the -arch i386
to the compilation flags. I'd like to add support for 32-bit clients on 10.5 and 10.6.
I get the following error messages (among others) which seem relevant to the lack of 32-bit libraries:
ld: warning: ignoring file /opt/local/lib/gcc47/libgcc_ext.10.5.dylib, missing required architecture i386 in file /opt/local/lib/gcc47/libgcc_ext.10.5.dylib (1 slices)
ld: warning: ignoring file /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/libgcc.a, file was built for archive which is not the architecture being linked (i386): /opt/local/lib/gcc47/gcc/x86_64-apple-darwin12/4.7.2/libgcc.a
My questions are:
Is there a different flag I should use for this, instead of -arch i386
?
Or, where can I obtain (or how can I compile) the i386
libraries I need to install, to get 32-bit support?
(Can I compile i386
architecture libraries from downloading GCC 4.7.2 source? Is there a specific set of options I should add to the ./configure
statement to enable this?)
Once these libraries are installed, how does my current gcc installation "know" where these libraries will be found?
Is there anything I can add via Xcode 4.5.2? I am already doing this on the command-line, but I can only see "command-line tools" and iOS simulators as download options in the Preferences applet.
Rebuilding the MacPorts installation of GCC 4.7.2 with the +universal
option provided support for compiling both 32- (i386
) and 64-bit (x86_64
) binaries.