Closed mangadul closed 7 years ago
I get the same error on SLES 11 and RHEL 6. The root cause seems to be, that Suhosin7 uses -std=c99 and for C99 the uint type is not defined. But zend_alloc.h included by zend.h via php.h from rfc1867.c uses the uint type. IMHO it is kind of a bug in PHP that they use non-standard types, or the PHP project might argue that extensions can not be written in C99. I doubt that the latter would be an acceptable reasoning.
The following patch (moving the stdio.h include behind the php includes) fixes it although I must confess that I don't fully understand why (and whether it is the right solution):
--- rfc1867.c 2016-10-01 21:31:19.717649000 +0200 +++ rfc1867.c 2016-10-01 21:29:42.694469000 +0200 @@ -33,7 +33,6 @@ /
-#include
@@ -44,6 +43,7 @@
+#include
Error appear when compiling suhosin on ubuntu 16.04
Error log:
`root@svr01:/home/mangadul/suhosin7# make /bin/bash /home/mangadul/suhosin7/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/mangadul/suhosin7 -DPHP_ATOM_INC -I/home/mangadul/suhosin7/include -I/home/mangadul/suhosin7/main -I/home/mangadul/suhosin7 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -std=c11 -c /home/mangadul/suhosin7/rfc1867.c -o rfc1867.lo libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/mangadul/suhosin7 -DPHP_ATOM_INC -I/home/mangadul/suhosin7/include -I/home/mangadul/suhosin7/main -I/home/mangadul/suhosin7 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -std=c11 -c /home/mangadul/suhosin7/rfc1867.c -fPIC -DPIC -o .libs/rfc1867.o In file included from /usr/include/php/20151012/Zend/zend.h:33:0, from /usr/include/php/20151012/main/php.h:36, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend_alloc.h:53:2: error: unknown type name ‘uint’ uint lineno; ^ /usr/include/php/20151012/Zend/zend_alloc.h:54:2: error: unknown type name ‘uint’ uint orig_lineno; ^ In file included from /usr/include/php/20151012/main/php.h:36:0, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend.h:196:69: error: unknown type name ‘uint’ void (error_function)(int type, const char error_filename, const uint error_lineno, const char format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); ^ /usr/include/php/20151012/Zend/zend.h:215:2: error: unknown type name ‘uint’ uint import_use_extension_length; ^ /usr/include/php/20151012/Zend/zend.h:246:55: error: unknown type name ‘uint’ ZEND_API ZEND_COLD void _zend_bailout(char filename, uint lineno); ^ /usr/include/php/20151012/Zend/zend.h:281:83: error: unknown type name ‘uint’ extern ZEND_API void (zend_error_cb)(int type, const char error_filename, const uint error_lineno, const char format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf ^ In file included from /usr/include/php/20151012/Zend/zend_API.h:31:0, from /usr/include/php/20151012/main/php.h:40, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend_execute.h:288:10: error: unknown type name ‘uint’ ZEND_API uint zend_get_executed_lineno(void); ^ In file included from /usr/include/php/20151012/main/php.h:40:0, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend_API.h:313:77: error: unknown type name ‘uint’ ZEND_API zend_bool zend_is_callable_ex(zval callable, zend_object *object, uint check_flags, zend_string callable_name, zend_fcall_info_cache *fcc, char *error); ^ /usr/include/php/20151012/Zend/zend_API.h:314:53: error: unknown type name ‘uint’ ZEND_API zend_bool zend_is_callable(zval callable, uint check_flags, zend_string callable_name); ^ /usr/include/php/20151012/Zend/zend_API.h:436:68: error: unknown type name ‘uint’ ZEND_API zval add_get_assoc_string_ex(zval arg, const char key, uint key_len, const char str); ^ /usr/include/php/20151012/Zend/zend_API.h:437:69: error: unknown type name ‘uint’ ZEND_API zval add_get_assoc_stringl_ex(zval arg, const char key, uint key_len, const char str, size_t length); ^ /usr/include/php/20151012/Zend/zend_API.h:487:51: error: unknown type name ‘uint’ ZEND_API int zend_fcall_info_init(zval callable, uint check_flags, zend_fcall_info fci, zend_fcall_info_cache *fcc, zend_string callable_name, char error); ^ In file included from /usr/include/php/20151012/Zend/zend_types.h:27:0, from /usr/include/php/20151012/Zend/zend.h:31, from /usr/include/php/20151012/main/php.h:36, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend_API.h: In function ‘zend_parse_arg_func’: /usr/include/php/20151012/Zend/zend_API.h:1221:24: warning: implicit declaration of function ‘zend_fcall_info_init’ [-Wimplicit-function-declaration] } else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error) != SUCCESS)) { ^ /usr/include/php/20151012/Zend/zend_portability.h:304:52: note: in definition of macro ‘UNEXPECTED’
define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
In file included from /usr/include/php/20151012/main/php.h:386:0, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/main/php_output.h: At top level: /usr/include/php/20151012/main/php_output.h:97:2: error: unknown type name ‘uint’ uint free:1; ^ /usr/include/php/20151012/main/php_output.h:98:2: error: unknown type name ‘uint’ uint _reserved:31; ^ In file included from /usr/include/php/20151012/main/php_ini.h:24:0, from /usr/include/php/20151012/main/fopen_wrappers.h:26, from /usr/include/php/20151012/main/php.h:391, from /home/mangadul/suhosin7/rfc1867.c:37: /usr/include/php/20151012/Zend/zend_ini.h:43:2: error: unknown type name ‘uint’ uint name_length; ^ /usr/include/php/20151012/Zend/zend_ini.h:44:2: error: unknown type name ‘uint’ uint value_length; ^ /usr/include/php/20151012/Zend/zend_ini.h:84:46: error: unknown type name ‘uint’ ZEND_API zend_long zend_ini_long(char name, uint name_length, int orig); ^ /usr/include/php/20151012/Zend/zend_ini.h:85:45: error: unknown type name ‘uint’ ZEND_API double zend_ini_double(char name, uint name_length, int orig); ^ /usr/include/php/20151012/Zend/zend_ini.h:86:44: error: unknown type name ‘uint’ ZEND_API char zend_ini_string(char name, uint name_length, int orig); ^ /usr/include/php/20151012/Zend/zend_ini.h:87:47: error: unknown type name ‘uint’ ZEND_API char zend_ini_string_ex(char name, uint name_length, int orig, zend_bool exists); ^ /usr/include/php/20151012/Zend/zend_ini.h:89:54: error: unknown type name ‘uint’ ZEND_API int zend_ini_register_displayer(char name, uint name_length, void (displayer)(zend_ini_entry ini_entry, int type)); ^ In file included from /usr/include/php/20151012/main/php_variables.h:26:0, from /home/mangadul/suhosin7/rfc1867.c:41: /usr/include/php/20151012/main/SAPI.h:281:2: error: unknown type name ‘uint’ uint content_type_len; ^ In file included from /usr/include/php/20151012/main/php.h:36:0, from /home/mangadul/suhosin7/rfc1867.c:37: /home/mangadul/suhosin7/php_suhosin7.h: In function ‘suhosin_bailout’: /usr/include/php/20151012/Zend/zend.h:221:25: warning: implicit declaration of function ‘_zend_bailout’ [-Wimplicit-function-declaration]
define zend_bailout() _zend_bailout(FILE, LINE)
/home/mangadul/suhosin7/php_suhosin7.h:428:3: note: in expansion of macro ‘zend_bailout’ zend_bailout(); ^ /home/mangadul/suhosin7/rfc1867.c: In function ‘php_mime_get_hdr_value’: /home/mangadul/suhosin7/rfc1867.c:500:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration] if (!strcasecmp(entry->key, key)) { ^ In file included from /usr/include/php/20151012/main/php_ini.h:24:0, from /usr/include/php/20151012/main/fopen_wrappers.h:26, from /usr/include/php/20151012/main/php.h:391, from /home/mangadul/suhosin7/rfc1867.c:37: /home/mangadul/suhosin7/rfc1867.c: In function ‘suhosin_rfc1867_post_handler’: /usr/include/php/20151012/Zend/zend_ini.h:139:23: warning: implicit declaration of function ‘zend_ini_long’ [-Wimplicit-function-declaration]
define INI_INT(name) zend_ini_long((name), sizeof(name)-1, 0)
/home/mangadul/suhosin7/rfc1867.c:723:19: note: in expansion of macro ‘INI_INT’ int upload_cnt = INI_INT("max_file_uploads"); ^ Makefile:221: recipe for target 'rfc1867.lo' failed make: *** [rfc1867.lo] Error 1 `