CopernicaMarketingSoftware / PHP-CPP

Library to build PHP extensions with C++
http://www.php-cpp.com/
Apache License 2.0
1.43k stars 333 forks source link

Build Failed in Mac #321

Open kstan79 opened 7 years ago

kstan79 commented 7 years ago

Hi,

I'd tried to build php-cpp in mac seems failed:

kstans-MacBook-Pro:PHP-CPP kstan$ make

mkdir -p shared/common
mkdir -p shared/zend
c++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g -fpic -o shared/common/modifiers.o common/modifiers.cpp
c++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g -fpic -o shared/common/streambuf.o common/streambuf.cpp
c++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g `php-config --includes` -fpic -o shared/zend/base.o zend/base.cpp
In file included from zend/base.cpp:8:
zend/includes.h:40:10: fatal error: 'php.h' file not found

I'm tried to download php7.0.15, replace zend folder result same.

Currently I'm use MAMP, I'd further edit Makefile as below: PHP_CONFIG=/Applications/MAMP/bin/php/php7.0.15/bin/php-config

It build for sometimes but halt at:

......
zend/valueiteratorimpl.h:37:32: note: overridden virtual function is here
    virtual ValueIteratorImpl *clone() = 0;
                               ^
5 warnings generated.
c++ -shared -g `/Applications/MAMP/bin/php/php7.0.15/bin/php-config --ldflags` -Wl,-soname,libphpcpp.so.2.0 -o libphpcpp.so.2.0.0 shared/common/modifiers.o shared/common/streambuf.o shared/zend/base.o shared/zend/callable.o shared/zend/classbase.o shared/zend/classimpl.o shared/zend/constant.o shared/zend/constantfuncs.o shared/zend/eval.o shared/zend/exception_handler.o shared/zend/exists.o shared/zend/extension.o shared/zend/extensionimpl.o shared/zend/fatalerror.o shared/zend/file.o shared/zend/function.o shared/zend/functor.o shared/zend/global.o shared/zend/globals.o shared/zend/hashmember.o shared/zend/ini.o shared/zend/inivalue.o shared/zend/iteratorimpl.o shared/zend/members.o shared/zend/module.o shared/zend/namespace.o shared/zend/object.o shared/zend/sapi.o shared/zend/script.o shared/zend/streambuf.o shared/zend/streams.o shared/zend/super.o shared/zend/value.o shared/zend/valueiterator.o shared/zend/zendcallable.o shared/zend/zval.o
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libphpcpp.so.2.0.0] Error 1

Anything I can do for make it work?

neyaoz commented 7 years ago

Up!

sjinks commented 7 years ago

Please see https://lists.apple.com/archives/unix-porting/2003/Oct/msg00032.html

It looks like for Mac instead of -Wl,-soname,libphpcpp.so.2.0 you will have to use -Wl,-dylib_install_name -Wl,libphpcpp.so.2.0

guweigang commented 7 years ago

I just replaced -soname with -install_name in Makefile, and it works.