0

I'm trying to install MapServer version 7.0.6. I also want php MapScript so I'm doing it by compiling from source. I've installed two versions of PHP (5.6 and 7) 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've also installed php5.6-dev on my system.

Is there any fix for this?

1 Answer 1

1

I seems that there was some kind of "conflict". Although php-v command was showing this:

PHP 5.6.31-4+ubuntu16.04.1+deb.sury.org+4 (cli) 

my systems was getting kind of confused. I removed version 7 and then retried to build and it worked. I also tried this patch:

--- 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

but it didn't work for me. So removing version 7 did the work for me here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.