I'm using a mac OSX and trying to compile a binary from source.
the commands I'm using are
/Applications/MAMP/bin/php5.3/bin/phpize CFLAG开发者_JAVA百科S='-O2 -arch i386 -arch ppc -g -Os' LDFLAGS='-O2 -arch i386 -arch ppc ' CXXFLAGS='-O2 -arch i386 -arch ppc -g -Os'
./configure --disable-dependancy-tracking --disable-shared -enable-static
make
make install
I've previously tried also including a number of other flags
-arch x86_64
and
--with-php-config="/Applications/MAMP/bin/php5.3/bin/php-config"
but every time I check the compiled file it tells me that it's an x86_64 bundle.
What am I missing?
Try adding -m32 to the flags. I doubt the optimization flags are making a difference here.
From the manual for gcc:
-m32 -m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture. For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options.
Random guess, possibly not correct. Try setting CC
instead.
CC="gcc -m32"
Edit:
Reason for my suggestion is that I don't know if CFLAGS is always respected in your build.
After configuring, I edited the Makefile and changed the following:
CC = cc to CC = cc -m32
And voila.
精彩评论