Finally I solved it. I thought the solution in the Github issue was modifying the Makefile in the source directory, while it was in fact the xhp/Makefile that was the issue.
The solution was to add do the following modifications to xhp/Makefile:
Change:
g++ -shared -Wl,-soname,libxhp.so -o libxhp.so $^
To:
g++ -m32 -shared -Wl,-arch,i386 -o libxhp.so $^
Change:
ifdef DEBUG
CPPFLAGS = -fPIC -ggdb -Wall -DDEBUG
else
CPPFLAGS = -fPIC -g -Wall -O3 -minline-all-stringops
endif
To:
ifdef DEBUG
CPPFLAGS = -fPIC -ggdb -Wall -DDEBUG -arch i386
else
CPPFLAGS = -fPIC -g -Wall -O3 -minline-all-stringops -arch i386
endif
Then configure with parameters:
./configure --with-php-config=/usr/local/zend/bin/php-config
--target=i386-apple-darwin10.8.2 --build=i386-apple-darwin
--host=i386-apple-darwin10.8.2 CFLAGS='-arch i386' LDFLAGS='-arch i386'
CC='gcc -m32' CXX='g++ -m32' CHOST='i386-apple-darwin10.8.2'
CPPFLAGS='-arch i386'
I don't know if all of the above steps are necessary, but it worked for me. Hopefully this will save someone else a couple of headaches.