Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

macos - Macports OSX 10.9.2: is -m32 compile possible?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...