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.83k stars 200 forks source link

v8js compile errors #41

Closed rbro closed 10 years ago

rbro commented 10 years ago

I am new to v8js and trying it out today for the first time. I'm running CentOS 6.4 64-bit with PHP 5.5.4. I followed the instructions listed in README.md to compile the latest versions of both v8 and php-v8js, but when compiling php-v8js, I'm getting the below error. I just pasted the first few errors, but a list of them occurs. Can you please let me know what might be causing it? Please also let me know if I can supply more information. Thanks for your help.

/bin/sh /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/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O0 -c /tmp/v8js/v8js.cc -o v8js.lo g++ -std=c++11 -I. -I/tmp/v8js -DPHP_ATOM_INC -I/tmp/v8js/include -I/tmp/v8js/main -I/tmp/v8js -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O0 -c /tmp/v8js/v8js.cc -fPIC -DPIC -o .libs/v8js.o /tmp/v8js/v8js.cc:74:1: warning: deprecated conversion from string constant to âchar_â [-Wwrite-strings] /tmp/v8js/v8js.cc:74:1: warning: deprecated conversion from string constant to âchar_â [-Wwrite-strings] /tmp/v8js/v8js.cc:74:1: warning: deprecated conversion from string constant to âcharâ [-Wwrite-strings] /tmp/v8js/v8js.cc: In function âzval php_v8js_v8_readproperty(zval, zval_, int, const zendliteral)â: /tmp/v8js/v8js.cc:119:49: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:119:76: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:121:43: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc: In function âvoid php_v8js_v8_writeproperty(zval, zval, zval, const zendliteral)â: /tmp/v8js/v8js.cc:152:16: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:152:43: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:153:13: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc: In function âvoid php_v8js_v8_unsetproperty(zval, zval_, const zendliteral)â: /tmp/v8js/v8js.cc:162:16: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:162:43: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits >â /tmp/v8js/v8js.cc:163:13: error: base operand of â->â has non-pointer type âv8::Persistent<v8::Value, v8::NonCopyablePersistentTraits

rbro commented 10 years ago

I tried a few different v8 versions and I was able to get v8js to compile with version 3.19.18.4, but I had to compile v8js with -D_GLIBCXX_USE_NANOSLEEP. Is there a certain version of v8 that should be used with v8js?

stesie commented 10 years ago

@rbro when using recent v8 versions together with v8js you need to compile with -DV8_USE_UNSAFE_HANDLES=1 as shown in the README file. Your compiler output above obviously is missing this directive. See issue #19 for details.

Compiling with -D_GLIBCXX_USE_NANOSLEEP is a work around for broken libstdc++ installations. See here for details: http://stackoverflow.com/questions/12523122/what-is-glibcxx-use-nanosleep-all-about

rbro commented 10 years ago

Thank you for your help. I was compiling with -DV8_USE_UNSAFE_HANDLES=1, but I think the issue is that I was compiling against the latest trunk of v8. When I used version 3.21.11 as you mentioned in issue #40, it worked.

Regarding -D_GLIBCXX_USE_NANOSLEEP, I think I needed to do that because of my g++ version. I am running CentOS 6.4 which has g++ version 4.4.7. I was though able to get v8js and v8 to compile under that version with the following workarounds:

1) compile v8 with:

make native library=shared -j8 werror=no

Without the werror=no, I was getting an error:

../src/splay-tree-inl.h: In member function "virtual void v8::internal::AstTyper::VisitVariableProxy(v8::internal::VariableProxy*)": ../src/splay-tree-inl.h:236: error: "dummy_node" may be used uninitialized in this function ../src/splay-tree-inl.h:236: note: "dummy_node" was declared here

2) In the v8js Makefile:

I'm not sure what side effects this may cause, but I was able to compile it and it runs under PHP 5.5.4.

satoshi75nakamoto commented 10 years ago

This issue appears to be resolved now.