By adding all undefined symbols to the -Wl,-flat_namespace,-U,_convert_to_boolean,-U,... switch, it compiled fine.
The undefined symbols as reported are:
_zval_is_true
_zend_lookup_class
__object_init
__zend_hash_add_or_update
_php_strtolower
So the command with -Wl,-flat_namespace,-U,_convert_to_boolean,-U,...,-U,_zval_is_true,-U,_zend_lookup_class,-U,__object_init,-U,__zend_hash_add_or_update,-U,_php_strtolower
compiled fine
The list of undefined symbols is in cmake_modules/FindPHP5.cmake, so the fix would be to update this file.
Also the output name of the zorba extension should be consistent with the content of zorba_api_wrapper.php:
- zorba_api_wrapper.php tries to load zorba_api.so
- the extension file is libzorba_api.so.
Once this is fixed, and php is configured to find the extension it works fine.
I've had the same error: wrap_swig_ zorba_api_ alter_newobject (int, _zval_struct*, _zval_struct**, _zval_struct*, int)in zorba_apiPHP5_ wrap.cxx. o lookup_ class", referenced from: ZTS_SetPointerZ val(_zval_ struct* , void*, swig_type_info*, int)in zorba_apiPHP5_ wrap.cxx. o ZTS_SetPointerZ val(_zval_ struct* , void*, swig_type_info*, int)in zorba_apiPHP5_ wrap.cxx. o hash_add_ or_update" , referenced from: ZTS_SetPointerZ val(_zval_ struct* , void*, swig_type_info*, int)in zorba_apiPHP5_ wrap.cxx. o strtolower" , referenced from: ZTS_SetPointerZ val(_zval_ struct* , void*, swig_type_info*, int)in zorba_apiPHP5_ wrap.cxx. o libzorba_ api.so] Error 1
Undefined symbols:
"_zval_is_true", referenced from:
_
"_zend_
SWIG_
"__object_init", referenced from:
SWIG_
(maybe you meant: __object_init_ex)
"__zend_
SWIG_
"_php_
SWIG_
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [swig/php/
Here's the command-line: local/var/ macports/ build/_ Users_andre_ MacPorts_ textproc_ zorba/zorba/ work/zorba- 2.0.2/build/ ../include -arch x86_64 -Wall -Wextra -Woverloaded- virtual -Wsign-promo -Winit-self -Wno-unused- parameter -fvisibility=hidden -fno-strict- aliasing -O3 -DNDEBUG -arch x86_64 -isysroot / -mmacosx- version- min=10. 6 -bundle -Wl,-headerpad_ max_install_ names -L/opt/local/lib -arch x86_64 -o libzorba_api.so CMakeFiles/ zorba_api. dir/zorba_ apiPHP5_ wrap.cxx. o ../../src/ libzorba_ simplestore. 2.0.2.dylib -bundle -Wl,-headerpad_ max_install_ names -Wl,-flat_ namespace, -U,_convert_ to_boolean, -U,_gc_ remove_ zval_from_ buffer, -U,_zend_ throw_exception ,-U,_zend_ register_ long_constant, -U,_zend_ get_constant, -U,__zval_ copy_ctor_ func,-U, __convert_ to_string, -U,__estrndup, -U,__efree, -U,__emalloc, -U,__estrdup, -U,__object_ init_ex, -U,__zend_ get_parameters_ array_ex, -U,__zend_ list_find, -U,__zval_ copy_ctor, -U,_add_ property_ zval_ex, -U,_alloc_ globals, -U,_compiler_ globals, -U,_convert_ to_double, -U,_convert_ to_long, -U,_zend_ error,- U,_zend_ hash_find, -U,_zend_ register_ internal_ class_ex, -U,_zend_ register_ list_destructor s_ex,-U, _zend_register_ resource, -U,_zend_ rsrc_list_ get_rsrc_ type,-U, _zend_wrong_ param_count, -U,_zval_ used_for_ init -lpthread /opt/local/ lib/libicuuc. dylib /opt/local/ lib/libicui18n. dylib /opt/local/ lib/libicudata. dylib /opt/local/ lib/libxml2. dylib /opt/local/ lib/libxslt. dylib /opt/local/ lib/libxerces- c.dylib /opt/local/ lib/libxml2. dylib /opt/local/ lib/libxslt. dylib /opt/local/ lib/libxerces- c.dylib
/usr/bin/g++-4.2 -pipe -O2 -I/opt/
By adding all undefined symbols to the -Wl,-flat_ namespace, -U,_convert_ to_boolean, -U,... switch, it compiled fine. hash_add_ or_update
The undefined symbols as reported are:
_zval_is_true
_zend_lookup_class
__object_init
__zend_
_php_strtolower
So the command with -Wl,-flat_ namespace, -U,_convert_ to_boolean, -U,..., -U,_zval_ is_true, -U,_zend_ lookup_ class,- U,__object_ init,-U, __zend_ hash_add_ or_update, -U,_php_ strtolower
compiled fine
The list of undefined symbols is in cmake_modules/ FindPHP5. cmake, so the fix would be to update this file.
Also the output name of the zorba extension should be consistent with the content of zorba_api_ wrapper. php: wrapper. php tries to load zorba_api.so
- zorba_api_
- the extension file is libzorba_api.so.
Once this is fixed, and php is configured to find the extension it works fine.
$ php simple.php
Example1:
<?xml version="1.0" encoding="UTF-8"?>
2
Example2:
2
Example3:
(no URI):1,1: dynamic error [err:FOAR0001]: division by zero
Example4:
(no URI):1,17: static error [err:XPST0003]: invalid expression: syntax error, unexpected "end of file"
Example5:
<?xml version="1.0" encoding="UTF-8"?>
<book>Book 1</book><book>Book 2</book>