PHP MapScript installation error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PHP MapScript installation error

Stefanos Anastasiou
Hi all,

I'm trying to install MapServer version 7.0.6. I want php mapscript so I'm doing it manually. I've installed two versions of php on my system (Linux Mint 18.1) but I've downgraded to 5.6 since as far as I'm concerned version 7 is still in development.  So everything worked well until I got this error: 

[ 82%] Building C object mapscript/php/CMakeFiles/php_mapscript.dir/mapscript_error.c.o
In file included from /usr/local/src/mapserver/mapscript/php/php_mapscript.h:37:0,
                 from /usr/local/src/mapserver/mapscript/php/mapscript_error.c:32:
/usr/local/src/mapserver/mapscript/php/php_mapscript_util.h:267:1: error: unknown type name ‘zend_object_value’
 zend_object_value mapscript_object_new(zend_object *zobj,
 ^
In file included from /usr/local/src/mapserver/mapscript/php/mapscript_error.c:32:0:
/usr/local/src/mapserver/mapscript/php/php_mapscript.h:461:8: error: unknown type name ‘zend_object_value’
 extern zend_object_value mapscript_object_new(zend_object *zobj, zend_class_entry *ce,
        ^
/usr/local/src/mapserver/mapscript/php/php_mapscript.h:463:8: error: unknown type name ‘zend_object_value’
 extern zend_object_value mapscript_object_new_ex(zend_object *zobj, zend_class_entry *ce,
        ^
/usr/local/src/mapserver/mapscript/php/mapscript_error.c: In function ‘mapscript_throw_exception’:
/usr/local/src/mapserver/mapscript/php/mapscript_error.c:53:10: warning: return from incompatible pointer type [-Wincompatible-pointer-types]
   return zend_throw_exception(mapscript_ce_mapscriptexception, message, 0 TSRMLS_CC);
          ^
/usr/local/src/mapserver/mapscript/php/mapscript_error.c: In function ‘zm_startup_mapscript_error’:
/usr/local/src/mapserver/mapscript/php/mapscript_error.c:114:37: error: too many arguments to function ‘zend_register_internal_class_ex’
   mapscript_ce_mapscriptexception = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), "Exception" TSRMLS_CC);
                                     ^
In file included from /usr/include/php/20160303/main/php.h:40:0,
                 from /usr/local/src/mapserver/mapscript/php/php_mapscript.h:35,
                 from /usr/local/src/mapserver/mapscript/php/mapscript_error.c:32:
/usr/include/php/20160303/Zend/zend_API.h:292:28: note: declared here
 ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce);
                            ^
mapscript/php/CMakeFiles/php_mapscript.dir/build.make:62: recipe for target 'mapscript/php/CMakeFiles/php_mapscript.dir/mapscript_error.c.o' failed
make[2]: *** [mapscript/php/CMakeFiles/php_mapscript.dir/mapscript_error.c.o] Error 1
CMakeFiles/Makefile2:547: recipe for target 'mapscript/php/CMakeFiles/php_mapscript.dir/all' failed
make[1]: *** [mapscript/php/CMakeFiles/php_mapscript.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2



I tried to apply this patch I found in a thread by Thomas:

--- a/mapscript/php/php_mapscript_util.h
+++ b/mapscript/php/php_mapscript_util.h
@@ -59,7 +59,9 @@
 #define Z_SET_REFCOUNT_P(pz, rc)    zval_set_refcount_p(pz, rc)
 #define Z_ADDREF_P(pz)          zval_addref_p(pz)
 #define Z_DELREF_P(pz)          zval_delref_p(pz)
+#if PHP_MAJOR_VERSION < 7
 #define Z_ISREF_P(pz)         zval_isref_p(pz)
+#endif
 #define Z_SET_ISREF_P(pz)       zval_set_isref_p(pz)
 #define Z_UNSET_ISREF_P(pz)       zval_unset_isref_p(pz)
 #define Z_SET_ISREF_TO_P(pz, isref)   zval_set_isref_to_p(pz, isref)
@@ -68,7 +70,9 @@
 #define Z_SET_REFCOUNT(z, rc)     Z_SET_REFCOUNT_P(&(z), rc)
 #define Z_ADDREF(z)           Z_ADDREF_P(&(z))
 #define Z_DELREF(z)           Z_DELREF_P(&(z))
+#if PHP_MAJOR_VERSION < 7
 #define Z_ISREF(z)            Z_ISREF_P(&(z))
+#endif
 #define Z_SET_ISREF(z)          Z_SET_ISREF_P(&(z))
 #define Z_UNSET_ISREF(z)        Z_UNSET_ISREF_P(&(z))
 #define Z_SET_ISREF_TO(z, isref)    Z_SET_ISREF_TO_P(&(z), isref)
@@ -81,6 +85,7 @@
 #define zend_always_inline inline
 #endif
 
+#if PHP_MAJOR_VERSION < 7
 static zend_always_inline zend_uint zval_refcount_p(zval* pz)
 {
   return pz->refcount;
@@ -120,6 +125,7 @@ static zend_always_inline zend_bool zval
 {
   return pz->is_ref = isref;
 }
+#endif
 
 #endif



I put it in the mapserver folder and not the build folder. But I'm still getting the same error. 

Any fix on this ?


I'm trying in at my localhost at the moment


Regards,
Stefanos



_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users