Create from the command line to create a binary for Mac OS 10.5 (and 10.6)

I mean the following source: http://clpbar.sourceforge.net

The build process is the standard: ./configurefollowed bymake

If I build on 10.5, I get a binary file whose filecontains: Mach-O executable i386
If I build on 10.6, I get a binary whose filecontains:Mach-O 64-bit executable x86_64

How can I build from the command line on 10.6 and create an executable file of the type Mach-O executable i386or even better a universal binary file containing executables of both types.

Please check all proposed solutions.

Thank you
matte

+3
source share
3 answers

From the Apple dev forums:

./configure CC="gcc -arch i386" CXX="g++ -arch i386"

Which works great.

+3
source

By default, the GCC version distributed with OS X 10.6 creates 64-bit binaries. The GCC version is distributed by default with 10.5 bits over 32-bit binaries.

Before starting. / configure set several environment variables. If you want it to be Intel Universal Binary with i386 and x86_64, set the following variables (assuming you use bash):

export CFLAGS="-arch i386 -arch x86_64"
export CXXFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS

This will tell the configure script to pass these compiler and linker parameters and thus build the binary with the i386 and x86_64 architecture.

Or, if you want it to be built only as an i386 binary:

export CFLAGS="-arch i386"
export CXXFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS
+3
source

-arch . , ,

gcc -arch i386 -arch x86_64 ...

. , gcc builds , x86_64 OSX 10.6.

+1
source

Source: https://habr.com/ru/post/1717079/


All Articles