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

Centos 7, PHP 7.2 compilation errors #374

Closed bobahvas closed 5 years ago

bobahvas commented 6 years ago

Hello, sorry for question in issues, but I cannot compile. Could anyone help with this issue?

[root@php v8js]# make
/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/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/v8/include -I/opt/v8  -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/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/v8/include -I/opt/v8 -DHAVE_CONFIG_H -g -O2 -c /tmp/v8js/v8js_array_access.cc  -fPIC -DPIC -o .libs/v8js_array_access.o
In file included from /opt/v8/include/v8.h:26:0,
                 from /tmp/v8js/php_v8js_macros.h:52,
                 from /tmp/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8config.h:326:49: warning: 'CallerOwnedBuffer' is deprecated (declared at /usr/include/c++/4.8.2/bits/stl_pair.h:96) [-Wdeprecated-declarations]
   declarator __attribute__((deprecated(message)))
                                                 ^
/opt/v8/include/v8.h:4348:5: note: in expansion of macro 'V8_DEPRECATED'
     V8_DEPRECATED(
     ^
/opt/v8/include/v8.h:4352:39: warning: 'v8::WasmCompiledModule::CallerOwnedBuffer' is deprecated (declared at /opt/v8/include/v8.h:4334): Use BufferReference. [-Wdeprecated-declarations]
                       inline operator CallerOwnedBuffer());
                                       ^
/opt/v8/include/v8config.h:326:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^
/opt/v8/include/v8.h:4352:39: warning: 'v8::WasmCompiledModule::CallerOwnedBuffer' is deprecated (declared at /opt/v8/include/v8.h:4334): Use BufferReference. [-Wdeprecated-declarations]
                       inline operator CallerOwnedBuffer());
                                       ^
/opt/v8/include/v8config.h:326:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^
In file included from /tmp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:4435:46: warning: 'CallerOwnedBuffer' is deprecated (declared at /usr/include/c++/4.8.2/bits/stl_pair.h:96) [-Wdeprecated-declarations]
     WasmCompiledModule::CallerOwnedBuffer buf)
                                              ^
/opt/v8/include/v8.h:4438:30: warning: 'v8::WasmCompiledModule::CallerOwnedBuffer' is deprecated (declared at /opt/v8/include/v8.h:4334): Use BufferReference. [-Wdeprecated-declarations]
 operator WasmCompiledModule::CallerOwnedBuffer() {
                              ^
/opt/v8/include/v8.h:4438:30: warning: 'v8::WasmCompiledModule::CallerOwnedBuffer' is deprecated (declared at /opt/v8/include/v8.h:4334): Use BufferReference. [-Wdeprecated-declarations]
/opt/v8/include/v8.h:4438:30: warning: 'v8::WasmCompiledModule::CallerOwnedBuffer' is deprecated (declared at /opt/v8/include/v8.h:4334): Use BufferReference. [-Wdeprecated-declarations]
/tmp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_named_getter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)':
/tmp/v8js/v8js_array_access.cc:226:37: error: no matching function for call to 'v8::String::Utf8Value::Utf8Value(v8::Local<v8::String>&)'
  v8::String::Utf8Value cstr(property);
                                     ^
/tmp/v8js/v8js_array_access.cc:226:37: note: candidate is:
In file included from /tmp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2960:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^
/opt/v8/include/v8.h:2960:5: note:   candidate expects 2 arguments, 1 provided
/tmp/v8js/v8js_array_access.cc:246:35: error: no matching function for call to 'v8::Value::ToObject()'
   ret_value = prototype->ToObject()->Get(property);
                                   ^
/tmp/v8js/v8js_array_access.cc:246:35: note: candidates are:
In file included from /tmp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2524:44: note: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                            ^
/opt/v8/include/v8.h:2524:44: note:   candidate expects 1 argument, 0 provided
In file included from /opt/v8/include/v8.h:26:0,
                 from /tmp/v8js/php_v8js_macros.h:52,
                 from /tmp/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2539:35: note: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/opt/v8/include/v8config.h:348:48: note: in definition of macro 'V8_DEPRECATE_SOON'
 #define V8_DEPRECATE_SOON(message, declarator) declarator
                                                ^
/opt/v8/include/v8.h:2539:35: note:   candidate expects 1 argument, 0 provided
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/opt/v8/include/v8config.h:348:48: note: in definition of macro 'V8_DEPRECATE_SOON'
 #define V8_DEPRECATE_SOON(message, declarator) declarator
                                                ^
make: *** [v8js_array_access.lo] Error 1
stesie commented 6 years ago

This is a bug in php-v8js, thanks for bringing this to attention (I haven't had the time to follow around cloesly recently).

If you just want to give php-v8js a try, you might want to use an older V8 version, like one or two minor versions down. That should be compilable for you and allow you to play around. Yet of course it's not a proper long term solution :-)

bobahvas commented 6 years ago

Thank you for your reply, @stesie

Works well with this release (from example)

git checkout 6.4.388.18
gclient sync

Would you fix this issue?

byalexandrepedrosa commented 6 years ago

@bobahvas Version 6.6.313 from they (google) manual, works on Debian.

https://media.readthedocs.org/pdf/php-v8/latest/php-v8.pdf

I got same error as you.

Without specify thet version on:

git

You probaly was doing same as me, pulling lastest one:

7.1.8 released one hour ago before wrote this post

https://github.com/v8/v8/releases

If you read the changes, almost all are for improvements of performance, no security issues or features.

stesie commented 6 years ago

Would you fix this issue?

... yeah, I'll look into it (somewhen soon). Currently I don't have an up-to-date version of V8 around, will have to package it for NixOS first :D

temuri416 commented 6 years ago

@stesie any chance looking at the problem? :)

stesie commented 6 years ago

@temuri416 here we go, I've finally got it working on V8 7.0.276.3, ... still needs some love though :)

stesie commented 6 years ago

@Jan-E I'm considering increasing minimal supported V8 version to 6.9.x, would you mind providing Windows binaries for V8 7.0 (or maybe 7.1 already) that we can use with AppVeyor?

Jan-E commented 6 years ago

I never got further than 6.8. And am head over heels in work and volleyball-hobby. So, not instantly.

Jan-E commented 6 years ago

My i7 laptop is crunching on V8 7.0.276.11 right now. I will report the results tomorrow (CEST). Unittests for the VC14 x64 build are OK:

[----------] Global test environment tear-down
[==========] 2884 tests from 235 test cases ran. (67258 ms total)
[  PASSED  ] 2884 tests.

  YOU HAVE 6 DISABLED TESTS
Jan-E commented 6 years ago

V8_ASSETS are here: https://phpdev.toolsforresearch.com/V8-7.0.276.11-vc15-x64.zip https://phpdev.toolsforresearch.com/V8-7.0.276.11-vc15-x86.zip https://phpdev.toolsforresearch.com/V8-7.0.276.11-vc14-x64.zip https://phpdev.toolsforresearch.com/V8-7.0.276.11-vc14-x86.zip

The Appveyor builds failed (with my branch): https://ci.appveyor.com/project/Jan-E/v8js-rx24a/build/1.0.56

A previous build in the same branch with V8-5.8.283.31-x64.zip went OK: https://ci.appveyor.com/project/Jan-E/v8js-rx24a/build/1.0.46

stesie commented 6 years ago

@Jan-E that was fast :+1: ... you need to merge https://github.com/stesie/v8js/tree/issue-374 into your branch when testing. Current master aka "php7" branch doesn't build on V8 7.0

Jan-E commented 6 years ago

Did the merge from my laptop in the train from Amsterdam to Rotterdam, connected with a Wifi hotspot on my mobile phone.

Looking good: https://ci.appveyor.com/project/Jan-E/v8js-rx24a/build/1.0.57

Jan-E commented 6 years ago

In the merge the libxml2 & libiconv got lost: https://github.com/Jan-E/v8js/commit/7d560878c9692d4624e6f7c6937d06ef620647dd Minor problem.

stesie commented 6 years ago

Great news, thank you very much @Jan-E :+1:

... now I'm the slow one again since I don't have the CI running for Ubuntu/Linux yet :smile:

Jan-E commented 6 years ago

https://ci.appveyor.com/project/Jan-E/v8js-rx24a/build/1.0.58 I chose the VC15 version everywhere for PHP 7.2 and 7.3, because that is their standard MSVC version. PHP 7.0 and 7.1 are built with VC14.

temuri416 commented 6 years ago

@stesie

Compiled latest v8 fine, however v8js fails:

 g++ -Wno-narrowing -std=c++11 -I. -I/root/install/v8js -DPHP_ATOM_INC -I/root/install/v8js/include -I/root/install/v8js/main -I/root/install/v8js -I/var/web/php/include/php -I/var/web/php/include/php/main -I/var/web/php/include/php/TSRM -I/var/web/php/include/php/Zend -I/var/web/php/include/php/ext -I/var/web/php/include/php/ext/date/lib -I/opt/v8/include -I/opt/v8 -DHAVE_CONFIG_H -g -O2 -c /root/install/v8js/v8js_array_access.cc  -fPIC -DPIC -o .libs/v8js_array_access.o
/root/install/v8js/v8js_array_access.cc: In function ‘void v8js_array_access_named_getter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)’:
/root/install/v8js/v8js_array_access.cc:226:37: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::String>&)’
  v8::String::Utf8Value cstr(property);
                                     ^
In file included from /root/install/v8js/php_v8js_macros.h:52:0,
                 from /root/install/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2874:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^
/opt/v8/include/v8.h:2874:5: note:   candidate expects 2 arguments, 1 provided
/root/install/v8js/v8js_array_access.cc:246:35: error: no matching function for call to ‘v8::Value::ToObject()’
   ret_value = prototype->ToObject()->Get(property);
                                   ^
In file included from /root/install/v8js/php_v8js_macros.h:52:0,
                 from /root/install/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2400:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                            ^
/opt/v8/include/v8.h:2400:44: note:   candidate expects 1 argument, 0 provided
In file included from /opt/v8/include/v8-internal.h:13:0,
                 from /opt/v8/include/v8.h:25,
                 from /root/install/v8js/php_v8js_macros.h:52,
                 from /root/install/v8js/v8js_array_access.cc:17:
/opt/v8/include/v8.h:2415:35: note: candidate: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/opt/v8/include/v8config.h:348:48: note: in definition of macro ‘V8_DEPRECATE_SOON’
 #define V8_DEPRECATE_SOON(message, declarator) declarator
                                                ^
/opt/v8/include/v8.h:2415:35: note:   candidate expects 1 argument, 0 provided
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/opt/v8/include/v8config.h:348:48: note: in definition of macro ‘V8_DEPRECATE_SOON’
 #define V8_DEPRECATE_SOON(message, declarator) declarator
                                                ^
Makefile:208: recipe for target 'v8js_array_access.lo' failed
make: *** [v8js_array_access.lo] Error 1

Were you able to compile it yourself?

Thanks!

stesie commented 6 years ago

@temuri416 which branch have you tried? It's not yet integrated in php7 branch, just the issue-374 one

temuri416 commented 6 years ago

yes, I was compiling from php7 branch. however, I don't see issue-374. how do I check that one out?

temuri416 commented 6 years ago

Ohh, found it:

https://github.com/stesie/v8js/tree/issue-374

temuri416 commented 6 years ago

yey:

root@dg72:~/install# php --ri v8js

v8js

V8 Javascript Engine => enabled
V8 Engine Compiled Version => 7.1.0
V8 Engine Linked Version => 7.1.0 (candidate)
Version => 2.1.0

Directive => Local Value => Master Value
v8js.flags => no value => no value
v8js.icudtl_dat_path => no value => no value
v8js.use_date => 0 => 0
v8js.use_array_access => 0 => 0
root@dg72:~/install#
temuri416 commented 6 years ago

when do you expect to merge it into php7 branch?

cheers!!

stesie commented 6 years ago

@temuri416 good question :) I wanted to get CI/Travis going w/ the new version before merging (currently it's broken, since using too old V8 version). @virgofx is already on that topic (i.e. taking over packaging for ubuntu from Bogdan), yet not ready ...

ejauregui1 commented 5 years ago

Hello! Are there any updates on when this will be merged into the php7 branch? Any update would be greatly appreciated. Thanks.