Fix when compiling the Redis php extension on OSX - mach-o, but wrong architecture
September 13, 2010
If you happen to get the error:
PHP Warning: PHP Startup: Unable to load dynamic library '/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so' - dlopen(/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so, 9): no suitable image found. Did find:
/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so: mach-o, but wrong architecture in Unknown on line 0
this is how I fixed it:
create a test.sh file anywhere, chmod 777 it, run it then do your normal
make clean
phpize
./configure
make
sudo make install
SCRIPT:
#!/bin/bash
MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
PHP Warning: PHP Startup: Unable to load dynamic library '/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so' - dlopen(/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so, 9): no suitable image found. Did find:
/Users/jim/Downloads/owlient-phpredis-2675d15/modules/redis.so: mach-o, but wrong architecture in Unknown on line 0
this is how I fixed it:
create a test.sh file anywhere, chmod 777 it, run it then do your normal
make clean
phpize
./configure
make
sudo make install
SCRIPT:
#!/bin/bash
MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET