Мне удалось скомпилировать и настроить V8, используя инструкцию здесь https://github.com/phpv8/v8js/blob/master/README.Linux.md. До недавнего времени все работало нормально. Я начал получать фатальную ошибку из PHP, которая говорила что-то вроде: «невозможно загрузить динамический библиотека V8».
Я попробовал все, что мог, чтобы исправить ошибку, но не смог. Поэтому я решил перекомпилировать и переустановить V8.
Но, когда я делаю;
cd /tmp
git clone https://github.com/preillyme/v8js.git
cd v8js
phpize
./configure
make
Я получаю следующую ошибку:
/bin/bash /tmp/v8js/libtool --mode=compile g++ -std=c++11 -I. -I/tmp/v8js -DPHP_ATOM_INC -I/tmp/v8js/include -I/tmp/v8js/main -I/tmp/v8js -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr -DHAVE_CONFIG_H -g -O2 -c /tmp/v8js/v8js_array_access.cc -o v8js_array_access.lo
libtool: compile: g++ -std=c++11 -I. -I/tmp/v8js -DPHP_ATOM_INC -I/tmp/v8js/include -I/tmp/v8js/main -I/tmp/v8js -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr -DHAVE_CONFIG_H -g -O2 -c /tmp/v8js/v8js_array_access.cc -fPIC -DPIC -o .libs/v8js_array_access.o
/tmp/v8js/v8js_array_access.cc:37:45: error: macro "ZVAL_STRING" requires 3 arguments, but only 2 given
ZVAL_STRING(&fci.function_name, method_name);
^
In file included from /tmp/v8js/php_v8js_macros.h:43:0,
from /tmp/v8js/v8js_array_access.cc:17:
/tmp/v8js/v8js_class.h:58:18: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
std::map<const zend_string *,v8js_tmpl_t> template_cache;
^
/tmp/v8js/v8js_class.h:58:43: error: wrong number of template arguments (1, should be 4)
std::map<const zend_string *,v8js_tmpl_t> template_cache;
^
In file included from /usr/include/c++/4.8/map:61:0,
from /tmp/v8js/php_v8js_macros.h:25,
from /tmp/v8js/v8js_array_access.cc:17:
/usr/include/c++/4.8/bits/stl_map.h:96:11: error: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
class map
^
In file included from /tmp/v8js/v8js_array_access.cc:17:0:
/tmp/v8js/php_v8js_macros.h:90:2: error: 'zend_string' does not name a type
zend_string *variable_name;
^
/tmp/v8js/v8js_array_access.cc: In function 'zval v8js_array_access_dispatch(zend_object*, const char*, int, uint32_t, zval)':
/tmp/v8js/v8js_array_access.cc:37:2: error: 'ZVAL_STRING' was not declared in this scope
ZVAL_STRING(&fci.function_name, method_name);
^
/tmp/v8js/v8js_array_access.cc:39:6: error: 'zend_fcall_info' has no member named 'retval'
fci.retval = &php_value;
^
/tmp/v8js/v8js_array_access.cc:46:13: error: cannot convert 'zval [2] {aka _zval_struct [2]}' to 'zval*** {aka _zval_struct***}' in assignment
fci.params = params;
^
/tmp/v8js/v8js_array_access.cc:48:6: error: 'zend_fcall_info' has no member named 'object'
fci.object = object;
^
In file included from /usr/include/php5/Zend/zend.h:841:0,
from /usr/include/php5/main/php.h:35,
from /tmp/v8js/php_v8js_macros.h:31,
from /tmp/v8js/v8js_array_access.cc:17:
/usr/include/php5/Zend/zend_variables.h:56:64: error: cannot convert 'zval** {aka _zval_struct**}' to 'zval* {aka _zval_struct*}' for argument '1' to 'void _zval_dtor(zval*)'
#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
^
/tmp/v8js/v8js_array_access.cc:52:2: note: in expansion of macro 'zval_dtor'
zval_dtor(&fci.function_name);
^
/tmp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_getter(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&)':
/tmp/v8js/v8js_array_access.cc:70:20: error: 'ZVAL_UNDEF' was not declared in this scope
ZVAL_UNDEF(&zvalue);
^
/tmp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_setter(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&)':
/tmp/v8js/v8js_array_access.cc:92:20: error: 'ZVAL_UNDEF' was not declared in this scope
ZVAL_UNDEF(&zvalue);
^
/tmp/v8js/v8js_array_access.cc: In function 'int v8js_array_access_get_count_result(zend_object*)':
/tmp/v8js/v8js_array_access.cc:116:20: error: 'ZVAL_UNDEF' was not declared in this scope
ZVAL_UNDEF(&zvalue);
^
/tmp/v8js/v8js_array_access.cc: In function 'bool v8js_array_access_isset_p(zend_object*, int)':
/tmp/v8js/v8js_array_access.cc:134:20: error: 'ZVAL_UNDEF' was not declared in this scope
ZVAL_UNDEF(&zvalue);
^
/tmp/v8js/v8js_array_access.cc:138:26: error: 'IS_TRUE' was not declared in this scope
if(Z_TYPE(php_value) != IS_TRUE && Z_TYPE(php_value) != IS_FALSE) {
^
/tmp/v8js/v8js_array_access.cc:138:58: error: 'IS_FALSE' was not declared in this scope
if(Z_TYPE(php_value) != IS_TRUE && Z_TYPE(php_value) != IS_FALSE) {
^
/tmp/v8js/v8js_array_access.cc:144:30: error: 'IS_TRUE' was not declared in this scope
return Z_TYPE(php_value) == IS_TRUE;
^
/tmp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_deleter(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&)':
/tmp/v8js/v8js_array_access.cc:175:20: error: 'ZVAL_UNDEF' was not declared in this scope
ZVAL_UNDEF(&zvalue);
^
In file included from /usr/include/php5/Zend/zend.h:841:0,
from /usr/include/php5/main/php.h:35,
from /tmp/v8js/php_v8js_macros.h:31,
from /tmp/v8js/v8js_array_access.cc:17:
/usr/include/php5/Zend/zend_variables.h:57:76: error: cannot convert 'zval* {aka _zval_struct*}' to 'zval** {aka _zval_struct**}' for argument '1' to 'void _zval_ptr_dtor(zval**)'
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/v8js/v8js_array_access.cc:178:2: note: in expansion of macro 'zval_ptr_dtor'
zval_ptr_dtor(&php_value);
^
make: *** [v8js_array_access.lo] Error 1
Я понятия не имею, что не так. Мне нужна помощь, пожалуйста.
Заранее спасибо.
Вы строите для PHP 7 или 5?
Вам нужно будет находиться в основной ветке preillyme / v8js, чтобы успешно собрать PHP 5.
Других решений пока нет …