Macos – How to compile a library in 32bit on a 64bit Mac machine (Mountain Lion)

32-bitbuildmacosmakefileosx-mountain-lion

I want to compile tesseract http://code.google.com/p/tesseract-ocr/ in 32bit on my Macbook. But I have a 64bit Mac OS Mountain Lion machine.

There is a Makefile, and I tried:

(1) $ ./configure –with-arch=i386
(2) $ $./configure –build=i386-apple-darwin –host=i386-apple-darwin –target=i386-apple-darwin

Both didn't work. The library compiled is still 64bit. Actually for (2) I see, after running the ./configure, it says somethings like "checking for i386-apple-darwin-g++ .. no", actually everything it checked for i386 had a "no" in the end. But the compilation succeed, just the library does not seem to be 32bit.

Anyone can help with this?

Best Answer

Try the -m32 to specify building 32-bit executables in the CFLAGS and CXXFLAGS. However, the MacOSX sdks for 10.7 and 10.8 don't have 32-bit i386 code to link against (only MacOSX10.6.sdk). I recommend using macports to install/build the tesseract engine on Mac OS X 10.7+.