当前系统环境我就不说了,如果你遇到如下类似报错,可以通过尝试更换gcc9版本
完美切换gcc版本方法:
如果gcc版本切换后问题依旧,可尝试通过本文底部方法解决:
完整报错如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
In file included from /php7.0.33/ext/intl/intl_convertcpp.cpp:21: /php7.0.33/ext/intl/intl_convertcpp.h:29:25: error: 'UnicodeString' was not declared in this scope; did you mean 'icu_69::UnicodeString'? 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~~~~~~~~~~~ | icu_69::UnicodeString In file included from /php7.0.33/ext/intl/intl_convertcpp.h:26, from /php7.0.33/ext/intl/intl_convertcpp.cpp:21: /usr/include/unicode/unistr.h:295:20: note: 'icu_69::UnicodeString' declared here 295 | class U_COMMON_API UnicodeString : public Replaceable | ^~~~~~~~~~~~~ In file included from /php7.0.33/ext/intl/intl_convertcpp.cpp:21: /php7.0.33/ext/intl/intl_convertcpp.h:29:40: error: 'ret' was not declared in this scope 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~ /php7.0.33/ext/intl/intl_convertcpp.h:29:45: error: expected primary-expression before 'char' 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~~ /php7.0.33/ext/intl/intl_convertcpp.h:29:63: error: expected primary-expression before 'str_len' 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.h:29:83: error: expected primary-expression before '*' token 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^ /bin/sh /php7.0.33/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/include -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/php7.0.33/ext/intl/ -DPHP_ATOM_INC -I/php7.0.33/include -I/php7.0.33/main -I/php7.0.33 -I/php7.0.33/ext/date/lib -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/php7.0.33/ext/mbstring/oniguruma -I/php7.0.33/ext/mbstring/libmbfl -I/php7.0.33/ext/mbstring/libmbfl/mbfl -I/php7.0.33/ext/sqlite3/libsqlite -I/php7.0.33/ext/zip/lib -I/php7.0.33/TSRM -I/php7.0.33/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /php7.0.33/ext/intl/collator/collator_convert.c -o ext/intl/collator/collator_convert.lo /php7.0.33/ext/intl/intl_convertcpp.h:29:84: error: 'status' was not declared in this scope; did you mean 'static'? 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~~~~ | static /php7.0.33/ext/intl/intl_convertcpp.h:29:90: error: expression list treated as compound expression in initializer [-fpermissive] 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^ /php7.0.33/ext/intl/intl_convertcpp.h:31:40: error: 'UnicodeString' does not name a type 31 | zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status); | ^~~~~~~~~~~~~ /bin/sh /php7.0.33/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/include -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/php7.0.33/ext/intl/ -DPHP_ATOM_INC -I/php7.0.33/include -I/php7.0.33/main -I/php7.0.33 -I/php7.0.33/ext/date/lib -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/php7.0.33/ext/mbstring/oniguruma -I/php7.0.33/ext/mbstring/libmbfl -I/php7.0.33/ext/mbstring/libmbfl/mbfl -I/php7.0.33/ext/sqlite3/libsqlite -I/php7.0.33/ext/zip/lib -I/php7.0.33/TSRM -I/php7.0.33/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /php7.0.33/ext/intl/collator/collator_locale.c -o ext/intl/collator/collator_locale.lo /php7.0.33/ext/intl/intl_convertcpp.cpp:28:5: error: redefinition of 'int intl_stringFromChar' 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~~~~~~~~~~~~~~~~~ In file included from /php7.0.33/ext/intl/intl_convertcpp.cpp:21: /php7.0.33/ext/intl/intl_convertcpp.h:29:5: note: 'int intl_stringFromChar' previously defined here 29 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status); | ^~~~~~~~~~~~~~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:25: error: 'UnicodeString' was not declared in this scope; did you mean 'icu_69::UnicodeString'? 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~~~~~~~~~~~ | icu_69::UnicodeString In file included from /php7.0.33/ext/intl/intl_convertcpp.h:26, from /php7.0.33/ext/intl/intl_convertcpp.cpp:21: /usr/include/unicode/unistr.h:295:20: note: 'icu_69::UnicodeString' declared here 295 | class U_COMMON_API UnicodeString : public Replaceable | ^~~~~~~~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:40: error: 'ret' was not declared in this scope 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:45: error: expected primary-expression before 'char' 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:63: error: expected primary-expression before 'str_len' 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:83: error: expected primary-expression before '*' token 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^ /php7.0.33/ext/intl/intl_convertcpp.cpp:28:84: error: 'status' was not declared in this scope; did you mean 'statx'? 28 | int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status) | ^~~~~~ | statx /php7.0.33/ext/intl/intl_convertcpp.cpp:59:40: error: 'UnicodeString' does not name a type 59 | zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status) | ^~~~~~~~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp: In function 'zend_string* intl_charFromString(const int&, UErrorCode*)': /php7.0.33/ext/intl/intl_convertcpp.cpp:63:11: error: request for member 'isBogus' in 'from', which is of non-class type 'const int' 63 | if (from.isBogus()) { | ^~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:69:26: error: request for member 'length' in 'from', which is of non-class type 'const int' 69 | int32_t capacity = from.length() * 3; | ^~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:71:11: error: request for member 'isEmpty' in 'from', which is of non-class type 'const int' 71 | if (from.isEmpty()) { | ^~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:77:31: error: request for member 'getBuffer' in 'from', which is of non-class type 'const int' 77 | const UChar *utf16buf = from.getBuffer(); | ^~~~~~~~~ /php7.0.33/ext/intl/intl_convertcpp.cpp:79:76: error: request for member 'length' in 'from', which is of non-class type 'const int' 79 | u_strToUTF8WithSub(ZSTR_VAL(u8res), capacity, &actual_len, utf16buf, from.length(), | ^~~~~~ make: *** [Makefile:1044: ext/intl/intl_convertcpp.lo] Error 1 make: *** Waiting for unfinished jobs.... /php7.0.33/ext/intl/collator/collator_sort.c: In function 'zif_collator_sort': /php7.0.33/ext/intl/collator/collator_sort.c:347:26: error: 'TRUE' undeclared (first use in this function) 347 | collator_sort_internal( TRUE, INTERNAL_FUNCTION_PARAM_PASSTHRU ); | ^~~~ /php7.0.33/ext/intl/collator/collator_sort.c:347:26: note: each undeclared identifier is reported only once for each function it appears in /php7.0.33/ext/intl/collator/collator_sort.c: In function 'zif_collator_asort': /php7.0.33/ext/intl/collator/collator_sort.c:541:26: error: 'FALSE' undeclared (first use in this function) 541 | collator_sort_internal( FALSE, INTERNAL_FUNCTION_PARAM_PASSTHRU ); | ^~~~~ make: *** [Makefile:1050: ext/intl/collator/collator_sort.lo] Error 1 /php7.0.33/ext/sqlite3/libsqlite/sqlite3.c: In function 'sqlite3Fts5IndexQuery': /php7.0.33/ext/sqlite3/libsqlite/sqlite3.c:190273:5: warning: 'memcpy' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] 190273 | memcpy(&buf.p[1], pToken, nToken); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
解决办法:执行以下三行,注意CPPFLAGS的空格不能省略
1 2 3 |
export CC="gcc -DTRUE=1 -DFALSE=0" export CXX="g++ -DTRUE=1 -DFALSE=0" export CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1' |
原文链接:编译php7.0报错intl/intl_convertcpp.h:29:25: error:,转载请注明来源!