Question

I have an old tool that need recompiling on Mac OSX 10.9.2, but the tool was written (not by me) with 32 bit assumptions, and a pure 64 bit compile won't work without rewriting.

Is it possible to use Macports gcc (4.3) and the -m32 flag? Will a 32 bit binary run on the 64 bit kernel of Mac OSX 10.9.2?

I tried using the option with a simple helloworld.c file and get errors and have not found explanations on the web:

%> gcc-mp-4.3 -m32 hello.c
ld: warning: ld: warning: ignoring file /opt/local/lib/gcc43/libgcc_s.10.5.dylib, missing required architecture i386 in file /opt/local/lib/gcc43/libgcc_s.10.5.dylib (1 slices)
ignoring file /opt/local/lib/gcc43/gcc/x86_64-apple-darwin13/4.3.6/libgcc.a, file was built for archive which is not the architecture being linked (i386): /opt/local/lib/gcc43/gcc/x86_64-apple-darwin13/4.3.6/libgcc.a

Note: native Xcode gcc is not compatible with the source since Xcode gcc is clang based.

Was it helpful?

Solution

The page at http://trac.macports.org/ticket/27925 describes how to install the compilers with 32 and 64 bit (aka universal) support.

Add "universal_archs x86_64 i386" to macports.conf and update the installed ports with "sudo port upgrade --enforce-variants gcc43 +universal" and it will re-install the compiler and build the i386 libraries in additional the the x64 libraries.

OTHER TIPS

Install the universal port of GCC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top