phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

v8js fails to build with libv8 version 3.8.9.20 #12

Closed stesie closed 11 years ago

stesie commented 11 years ago

Hi there,

v8js fails to build from source with libv8 version 3.8.9.20, as currently packaged in Debian Wheezy. However the README file states it requires at least 3.2.4

Here is how the build fails ...

libtool: compile:  g++ -std=c++11 -I. -I/home/stesie/Projekte/v8js -DPHP_ATOM_INC -I/home/stesie/Projekte/v8js/include -I/home/stesie/Projekte/v8js/main -I/home/stesie/Projekte/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 -DHAVE_CONFIG_H -g -O2 -c /home/stesie/Projekte/v8js/v8js.cc  -fPIC -DPIC -o .libs/v8js.o
/home/stesie/Projekte/v8js/v8js.cc:80:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/home/stesie/Projekte/v8js/v8js.cc:80:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/home/stesie/Projekte/v8js/v8js.cc:80:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/home/stesie/Projekte/v8js/v8js.cc: In function 'HashTable* php_v8js_v8_get_properties(zval*)':
/home/stesie/Projekte/v8js/v8js.cc:233:42: error: no matching function for call to 'v8::HandleScope::HandleScope(v8::Isolate*&)'
/home/stesie/Projekte/v8js/v8js.cc:233:42: note: candidates are:
In file included from /home/stesie/Projekte/v8js/php_v8js_macros.h:30:0,
                 from /home/stesie/Projekte/v8js/v8js.cc:28:
/usr/include/v8.h:463:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
/usr/include/v8.h:463:3: note:   no known conversion for argument 1 from 'v8::Isolate*' to 'const v8::HandleScope&'
/usr/include/v8.h:438:3: note: v8::HandleScope::HandleScope()
/usr/include/v8.h:438:3: note:   candidate expects 0 arguments, 1 provided
/home/stesie/Projekte/v8js/v8js.cc: In function 'void zim_V8Js___construct(int, zval*, zval**, zval*, int)':
/home/stesie/Projekte/v8js/v8js.cc:580:41: error: no matching function for call to 'v8::HandleScope::HandleScope(v8::Isolate*&)'
/home/stesie/Projekte/v8js/v8js.cc:580:41: note: candidates are:
In file included from /home/stesie/Projekte/v8js/php_v8js_macros.h:30:0,
                 from /home/stesie/Projekte/v8js/v8js.cc:28:
/usr/include/v8.h:463:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
/usr/include/v8.h:463:3: note:   no known conversion for argument 1 from 'v8::Isolate*' to 'const v8::HandleScope&'
/usr/include/v8.h:438:3: note: v8::HandleScope::HandleScope()
/usr/include/v8.h:438:3: note:   candidate expects 0 arguments, 1 provided
/home/stesie/Projekte/v8js/v8js.cc:597:14: error: 'class v8::Context' has no member named 'SetAlignedPointerInEmbedderData'
/home/stesie/Projekte/v8js/v8js.cc: In function 'void php_v8js_timer_thread()':
/home/stesie/Projekte/v8js/v8js.cc:714:16: error: 'class v8::Isolate' has no member named 'GetHeapStatistics'
/home/stesie/Projekte/v8js/v8js.cc: In function 'void zim_V8Js_executeString(int, zval*, zval**, zval*, int)':
/home/stesie/Projekte/v8js/v8js.cc:761:41: error: no matching function for call to 'v8::HandleScope::HandleScope(v8::Isolate*&)'
/home/stesie/Projekte/v8js/v8js.cc:761:41: note: candidates are:
In file included from /home/stesie/Projekte/v8js/php_v8js_macros.h:30:0,
                 from /home/stesie/Projekte/v8js/v8js.cc:28:
/usr/include/v8.h:463:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
/usr/include/v8.h:463:3: note:   no known conversion for argument 1 from 'v8::Isolate*' to 'const v8::HandleScope&'
/usr/include/v8.h:438:3: note: v8::HandleScope::HandleScope()
/usr/include/v8.h:438:3: note:   candidate expects 0 arguments, 1 provided
/home/stesie/Projekte/v8js/v8js.cc: In function 'void php_v8js_persistent_zval_ctor(zval**)':
/home/stesie/Projekte/v8js/v8js.cc:902:4: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/home/stesie/Projekte/v8js/v8js.cc: In function 'void php_v8js_persistent_zval_dtor(zval**)':
/home/stesie/Projekte/v8js/v8js.cc:915:4: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/home/stesie/Projekte/v8js/v8js.cc: At global scope:
/home/stesie/Projekte/v8js/v8js.cc:1051:1: warning: narrowing conversion of '-1' from 'int' to 'zend_uint {aka unsigned int}' inside { } [-Wnarrowing]
/home/stesie/Projekte/v8js/v8js.cc:1065:1: warning: narrowing conversion of '-1' from 'int' to 'zend_uint {aka unsigned int}' inside { } [-Wnarrowing]
/home/stesie/Projekte/v8js/v8js.cc:1068:1: warning: narrowing conversion of '-1' from 'int' to 'zend_uint {aka unsigned int}' inside { } [-Wnarrowing]
/home/stesie/Projekte/v8js/v8js.cc: In function 'void php_v8js_write_property(zval*, zval*, zval*, const zend_literal*)':
/home/stesie/Projekte/v8js/v8js.cc:1088:41: error: no matching function for call to 'v8::HandleScope::HandleScope(v8::Isolate*&)'
/home/stesie/Projekte/v8js/v8js.cc:1088:41: note: candidates are:
In file included from /home/stesie/Projekte/v8js/php_v8js_macros.h:30:0,
                 from /home/stesie/Projekte/v8js/v8js.cc:28:
/usr/include/v8.h:463:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
/usr/include/v8.h:463:3: note:   no known conversion for argument 1 from 'v8::Isolate*' to 'const v8::HandleScope&'
/usr/include/v8.h:438:3: note: v8::HandleScope::HandleScope()
/usr/include/v8.h:438:3: note:   candidate expects 0 arguments, 1 provided
/home/stesie/Projekte/v8js/v8js.cc: In function 'void php_v8js_unset_property(zval*, zval*, const zend_literal*)':
/home/stesie/Projekte/v8js/v8js.cc:1105:41: error: no matching function for call to 'v8::HandleScope::HandleScope(v8::Isolate*&)'
/home/stesie/Projekte/v8js/v8js.cc:1105:41: note: candidates are:
In file included from /home/stesie/Projekte/v8js/php_v8js_macros.h:30:0,
                 from /home/stesie/Projekte/v8js/v8js.cc:28:
/usr/include/v8.h:463:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
/usr/include/v8.h:463:3: note:   no known conversion for argument 1 from 'v8::Isolate*' to 'const v8::HandleScope&'
/usr/include/v8.h:438:3: note: v8::HandleScope::HandleScope()
/usr/include/v8.h:438:3: note:   candidate expects 0 arguments, 1 provided
make: *** [v8js.lo] Error 1

... which seems to be caused by commit 8d8c671aa07f488d0590043f1395ba8c8fac53ba, which passes v8::Isolate to v8::HandleScope::HandleScope

From v8's ChangeLog:

2013-03-15: Version 3.17.11

        Added a version of the v8::HandleScope constructor with an v8::Isolate
        parameter and made AdjustAmountOfExternalAllocatedMemory an instance
        method of v8::Isolate.
        (issue 2487)

... hence I ask you to please update the README to reflect the requirement.

cheers stesie

beest commented 11 years ago

Hi @stesie, thanks for the info here.

Can I confirm that the build will fail with libv8 >= 3.8.9.20, or is this a problem with a very specific version that has now been fixed in later libv8 releases?

The v8::Isolates need to be passed to v8::HandleScope::HandleScope in order to maintain isolated code execution between separate V8Js objects. This is fundamental to the time and memory limit checking.

stesie commented 11 years ago

Thanks @beest, this is, we should update the README file accordingly then. Shall I provide a pull request?

cscott commented 11 years ago

I can confirm that I still see the above issue with libv8 3.14.5.8.

stesie commented 11 years ago

Closing this, since pull request #30 was merged.

satoshi75nakamoto commented 11 years ago

Thanks @stesie