在macbookpro下面编译报错···
visionyimian opened this issue · 2 comments
PHP-X/examples/cpp_ext~ make
c++ -DHAVE_CONFIG_H -g -o cpp_ext.so -O0 -fPIC -shared extension.cpp -std=c++11 -lphpx php-config --includes
-Iphp-config --include-dir
Undefined symbols for architecture x86_64:
"___zend_malloc", referenced from:
php::Variant::Variant(char const*) in extension-21f5f7.o
php::String::String(char const*) in extension-21f5f7.o
"__array_init", referenced from:
php::Array::Array(php::Variant&) in extension-21f5f7.o
"__efree", referenced from:
php::String::~String() in extension-21f5f7.o
"__emalloc", referenced from:
php::Variant::Variant(char const*) in extension-21f5f7.o
php::String::String(char const*) in extension-21f5f7.o
"__zval_ptr_dtor", referenced from:
php::Variant::~Variant() in extension-21f5f7.o
"_add_index_zval", referenced from:
php::Array::set(int, php::Variant) in extension-21f5f7.o
"_zend_fetch_resource", referenced from:
php::String* php::Variant::toResourcephp::String(char const*) in extension-21f5f7.o
"_zend_read_property", referenced from:
php::Object::get(char const*) in extension-21f5f7.o
"_zend_register_resource", referenced from:
php::Variant php::newResourcephp::String(char const*, php::String*) in extension-21f5f7.o
"_zend_update_property", referenced from:
php::Object::set(char const*, php::Variant&) in extension-21f5f7.o
"_zval_add_ref", referenced from:
php::Variant::addRef() in extension-21f5f7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [cpp_ext.so] Error 1
MacOS编译时需要修改Makefile,为g++/clang++增加-undefined dynamic_lookup编译参数
https://wiki.swoole.com/wiki/index/prid-15
下一个版本会考虑自动生成扩展的cmake文件来解决。
非常感谢!开始愉快地研究了!