Question

I'm trying to install xhp on my local machine, a Macbook pro running os x 10.8.2, aka Mountain Lion (64 bit). I've xampp with the development package installed.

I've already spent many hours trying to get it to work, and I think I'm pretty close. But... I've installed all the dependencies through homebrew, upgraded my XCode version and installed the XCode command line tools.

Through research, I've learned that xampp is running in 32bit mode, while Mountain Lion (Snow Leopard in the article, but I'm guessing its the same thing here) compiles things in 64bit mode.

This is where I run into troubles. I've tried to ./configure the following ways:

  1. ./configure

  2. CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure

  3. MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1

1) fails at make. Probably because of the 32/64 bit problem.

2) and 3) succeeds, but it breaks PHP. After adding the xhp.so extension to php.ini, and running some arbitrary, but valid PHP code, I get the following error:

http://pastebin.com/80w2sWQN

I've found the same problem as an issue on Github, but my makefile does not match the one in the solution.

Any ideas?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top