Skip to content

Instantly share code, notes, and snippets.

@aozisik
Last active June 14, 2023 12:28
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save aozisik/a522e3b602daff6ae51f134aa949eec9 to your computer and use it in GitHub Desktop.
Save aozisik/a522e3b602daff6ae51f134aa949eec9 to your computer and use it in GitHub Desktop.
Installing PHP v8js on Ubuntu 18.04 Bionic or Mac OS Mojave (brew)
# This will retrieve v8 7.4.288.25 when installled
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/0a6171330678879285f2c566db9349da421d6f62/Formula/v8.rb
brew install v8.rb
brew list v8
# You will see this:
# /usr/local/Cellar/v8/7.4.288.25/bin/d8
# /usr/local/Cellar/v8/7.4.288.25/libexec/include/ (21 files)
# /usr/local/Cellar/v8/7.4.288.25/libexec/ (7 files)
mkdir -p /usr/local/Cellar/v8/7.4.288.25/libexec/lib
cp /usr/local/Cellar/v8/7.4.288.25/libexec/* /usr/local/Cellar/v8/7.4.288.25/libexec/lib
# Ignore the following errors, everything is fine:
# cp: /usr/local/Cellar/v8/7.4.288.25/libexec/include is a directory (not copied).
# cp: /usr/local/Cellar/v8/7.4.288.25/libexec/lib is a directory (not copied).
cd /tmp
git clone https://github.com/phpv8/v8js
cd v8js
git checkout php7
phpize
./configure CXXFLAGS="-Wno-c++11-narrowing" --with-v8js="/usr/local/Cellar/v8/7.4.288.25/libexec"
make
make test
# Make sure that make test succeeds
make install
# Expected output:
# Installing shared extensions: /usr/local/Cellar/php@7.2/7.2.18/pecl/20170718/
# Check if it's already working:
php -m | grep v8js
# No? It's not there?
# You may need to add v8js.so to your php.ini
# Locate your php.ini by doing:
php --ini
# Open the file and add: extension="v8js.so"
# Enjoy!
# Guys/gals... This took >4 hours to get right.
#
# Here are some troubleshooting checklist in case you're getting errors:
#
# - Make sure you have no other v8 libraries lying around your system. Get rid of those first!
# - Run apt-get update and upgrade before running this. Obviously...
# - I got v8js-2.0.0 working against 6.4.388.18. Never got it to work against v8-7.x...
# - Don't even try apt-get install libv8-7.2. Lost hours, couldn't get it to work... Just compile yourself...
# Install required dependencies
apt-get install build-essential curl git python libglib2.0-dev
cd /tmp
# Install depot_tools first (needed for source checkout)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
# Download v8
fetch v8
cd v8
# I needed this to make it work with PHP 7.1
git checkout 6.4.388.18
gclient sync
# Setup GN
tools/dev/v8gen.py -vv x64.release -- is_component_build=true
# Build
ninja -C out.gn/x64.release/
# Move libraries to necessary location
cp out.gn/x64.release/lib*.so /usr/lib/
cp out.gn/x64.release/*_blob.bin /usr/lib
cp out.gn/x64.release/icudtl.dat /usr/lib
cp -R include/* /usr/include
cd out.gn/x64.release/obj
ar rcsDT libv8_libplatform.a v8_libplatform/*.o
# Are you getting v8 (library) not found error? Try this before pecl install:
apt-get install patchelf
for A in /usr/lib/*.so; do patchelf --set-rpath '$ORIGIN' $A;done
# Then let's pull v8js.
cd /tmp
git clone https://github.com/phpv8/v8js.git
cd v8js
# Checkout version 2.1.0
git checkout 2.1.0
phpize
# This flag is important!
./configure LDFLAGS="-lstdc++" --with-v8js=/usr
make clean
make
# Make sure that the tests pass...
make test
make install
# DON'T FORGET TO Add
# extension=v8js.so
# To your php.ini as needed.
# You can check if the module is there by doing php -m | grep v8js
@hamzaali00001
Copy link

hamzaali00001 commented Jan 8, 2019

When I run pecl install v8js. I get the following error message

In file included from /usr/include/dirent.h:245:0,
                 from /usr/include/php/20170718/Zend/zend_virtual_cwd.h:78,
                 from /usr/include/php/20170718/main/php.h:471,
                 from /tmp/pear/temp/v8js/php_v8js_macros.h:42,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/tmp/pear/temp/v8js/v8js_class.h: In function ‘v8js_ctx* v8js_ctx_fetch_object(zend_object*)’:
/tmp/pear/temp/v8js/v8js_class.h:84:54: warning: offsetof within non-standard-layout type ‘v8js_ctx’ is undefined [-Winvalid-offsetof]
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
/tmp/pear/temp/v8js/v8js_class.h:84:43: note: in expansion of macro ‘XtOffsetOf’
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
                                           ^~~~~~~~~~
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:55:0,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/tmp/pear/temp/v8js/v8js_array_access.cc: In function ‘void v8js_array_access_enumerator(const v8::PropertyCallbackInfo<v8::Array>&)’:
/tmp/pear/temp/v8js/v8js_v8.h:23:57: warning: ‘static v8::Local<v8::String> v8::String::NewFromUtf8(v8::Isolate*, const char*, v8::String::NewStringType, int)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
 #define V8JS_STR(v)   v8::String::NewFromUtf8(isolate, v)
                                                         ^
/tmp/pear/temp/v8js/v8js_array_access.cc:217:14: note: in expansion of macro ‘V8JS_STR’
  result->Set(V8JS_STR("length"), V8JS_INT(i));
              ^~~~~~~~
In file included from /usr/include/v8-internal.h:13:0,
                 from /usr/include/v8.h:25,
                 from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:2750:10: note: declared here
   static V8_DEPRECATED(
          ^
/tmp/pear/temp/v8js/v8js_array_access.cc: In function ‘void v8js_array_access_named_getter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)’:
/tmp/pear/temp/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 /tmp/pear/temp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:2855:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/usr/include/v8.h:2855:5: note:   candidate expects 2 arguments, 1 provided
/tmp/pear/temp/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 /tmp/pear/temp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:2388:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                            ^~~~~~~~
/usr/include/v8.h:2388:44: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/v8-internal.h:13:0,
                 from /usr/include/v8.h:25,
                 from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:2401:3: note: candidate: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
   V8_DEPRECATE_SOON("Use maybe version",
   ^
/usr/include/v8.h:2401:3: note:   candidate expects 1 argument, 0 provided
Makefile:208: recipe for target 'v8js_array_access.lo' failed
make: *** [v8js_array_access.lo] Error 1
ERROR: `make' failed```

@freez10
Copy link

freez10 commented Mar 2, 2019

Thanks a lot for sharing this

@msacar
Copy link

msacar commented Mar 9, 2019

Thanks.

@aozisik
Copy link
Author

aozisik commented Jun 18, 2019

@hamzaali00001 Don't install v8js from PECL on Ubuntu 18.04. It's broken for some reason and you'll get SIGABRT 6 whenever you try to use the library. You'll need to build it yourself with the special build tag I showed above.

@sss03
Copy link

sss03 commented Jun 22, 2019

Hi
Even after following the steps i get this

➜ v8js git:(0966339) ✗ make /bin/bash /tmp/v8js/libtool --mode=compile g++ -Wno-narrowing -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/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/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++ -Wno-narrowing -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/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/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 In file included from /usr/include/dirent.h:245:0, from /usr/include/php/20170718/Zend/zend_virtual_cwd.h:78, from /usr/include/php/20170718/main/php.h:471, from /tmp/v8js/php_v8js_macros.h:42, from /tmp/v8js/v8js_array_access.cc:17: /tmp/v8js/v8js_class.h: In function ‘v8js_ctx* v8js_ctx_fetch_object(zend_object*)’: /tmp/v8js/v8js_class.h:84:54: warning: offsetof within non-standard-layout type ‘v8js_ctx’ is undefined [-Winvalid-offsetof] return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std)); /tmp/v8js/v8js_class.h:84:43: note: in expansion of macro ‘XtOffsetOf’ return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std)); ^~~~~~~~~~ /tmp/v8js/v8js_array_access.cc: In function ‘void v8js_array_access_enumerator(const v8::PropertyCallbackInfo<v8::Array>&)’: /tmp/v8js/v8js_array_access.cc:213:33: warning: ‘bool v8::Object::Set(uint32_t, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations] result->Set(i ++, V8JS_INT(j)); ^ In file included from /usr/local/include/v8-internal.h:14:0, from /usr/local/include/v8.h:25, from /tmp/v8js/php_v8js_macros.h:52, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:3300:3: note: declared here V8_DEPRECATED("Use maybe version", ^ /tmp/v8js/v8js_array_access.cc:217:45: error: no matching function for call to ‘v8::Array::Set(v8::MaybeLocal<v8::String>, v8::Local<v8::Integer>)’ result->Set(V8JS_STR("length"), V8JS_INT(i)); ^ In file included from /usr/local/include/v8-internal.h:14:0, from /usr/local/include/v8.h:25, from /tmp/v8js/php_v8js_macros.h:52, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:3291:3: note: candidate: bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>) V8_DEPRECATED("Use maybe version", ^ /usr/local/include/v8.h:3291:3: note: no known conversion for argument 1 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::Value>’ In file included from /tmp/v8js/php_v8js_macros.h:52:0, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:3297:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>) V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, ^~~ /usr/local/include/v8.h:3297:37: note: candidate expects 3 arguments, 2 provided In file included from /usr/local/include/v8-internal.h:14:0, from /usr/local/include/v8.h:25, from /tmp/v8js/php_v8js_macros.h:52, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:3300:3: note: candidate: bool v8::Object::Set(uint32_t, v8::Local<v8::Value>) V8_DEPRECATED("Use maybe version", ^ /usr/local/include/v8.h:3300:3: note: no known conversion for argument 1 from ‘v8::MaybeLocal<v8::String>’ to ‘uint32_t {aka unsigned int}’ In file included from /tmp/v8js/php_v8js_macros.h:52:0, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:3302:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>) V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index, ^~~ /usr/local/include/v8.h:3302:37: note: candidate expects 3 arguments, 2 provided /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); ^ In file included from /tmp/v8js/php_v8js_macros.h:52:0, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:2928:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>) Utf8Value(Isolate* isolate, Local<v8::Value> obj); ^~~~~~~~~ /usr/local/include/v8.h:2928: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); ^ In file included from /tmp/v8js/php_v8js_macros.h:52:0, from /tmp/v8js/v8js_array_access.cc:17: /usr/local/include/v8.h:2502:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject( ^~~~~~~~ /usr/local/include/v8.h:2502:44: note: candidate expects 1 argument, 0 provided Makefile:208: recipe for target 'v8js_array_access.lo' failed make: *** [v8js_array_access.lo] Error 1

Please help.
Regards

@aozisik
Copy link
Author

aozisik commented Jun 23, 2019

@ss03 I'm familiar with this error, but don't know exactly what caused it. It's either your v8 version or you're not following the gist step by step. Make sure you get rid of all the pre-existing v8 versions and install the versions that I point out in the gist. Wish you lots of luck

Copy link

ghost commented Jul 30, 2019

Could you please update your script on this?
I'm still having errors on the compilation, despite following your script as of now.
Does it works with PHP7.2 only or is PHP7.3 also included?
Why haven't you included gcc+, etc.
Because I've launched the script directly after installing my VPS, on the assumption that everything was already there.

@aozisik
Copy link
Author

aozisik commented Jul 30, 2019

Could you please update your script on this?
I'm still having errors on the compilation, despite following your script as of now.
Does it works with PHP7.2 only or is PHP7.3 also included?
Why haven't you included gcc+, etc.
Because I've launched the script directly after installing my VPS, on the assumption that everything was already there.

It's something that worked for me. Sorry that it didn't work for you.
What's your setup (distro version) ? And what error did you get?

Copy link

ghost commented Jul 31, 2019

I received this error, after everything went well, and all I had to do, in order to complet the case, was to execute make && make test && make install.

/bin/bash /tmp/v8js/libtool --mode=compile g++ -Wno-narrowing -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/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib -I/opt/v8/include -I/opt/v8  -DHAVE_CONFIG_H  -g -O2   -c /tmp/v8js/v8js_convert.cc -o v8js_convert.lo 
libtool: compile:  g++ -Wno-narrowing -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/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib -I/opt/v8/include -I/opt/v8 -DHAVE_CONFIG_H -g -O2 -c /tmp/v8js/v8js_convert.cc  -fPIC -DPIC -o .libs/v8js_convert.o
Makefile:214: recipe for target 'v8js_convert.lo' failed
dark-aii@vps12345:/tmp/v8js$ make
/bin/bash /tmp/v8js/libtool --mode=compile g++ -Wno-narrowing -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/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib -I/opt/v8/include -I/opt/v8  -DHAVE_CONFIG_H  -g -O2   -c /tmp/v8js/v8js_convert.cc -o v8js_convert.lo 
libtool: compile:  g++ -Wno-narrowing -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/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib -I/opt/v8/include -I/opt/v8 -DHAVE_CONFIG_H -g -O2 -c /tmp/v8js/v8js_convert.cc  -fPIC -DPIC -o .libs/v8js_convert.o
In file included from /usr/include/dirent.h:245:0,
                 from /usr/include/php/20180731/Zend/zend_virtual_cwd.h:76,
                 from /usr/include/php/20180731/main/php.h:467,
                 from /tmp/v8js/php_v8js_macros.h:42,
                 from /tmp/v8js/v8js_convert.cc:22:
/tmp/v8js/v8js_class.h: In function ‘v8js_ctx* v8js_ctx_fetch_object(zend_object*)’:
/tmp/v8js/v8js_class.h:83:54: warning: offsetof within non-standard-layout type ‘v8js_ctx’ is undefined [-Winvalid-offsetof]
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
/tmp/v8js/v8js_class.h:83:43: note: in expansion of macro ‘XtOffsetOf’
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
                                           ^~~~~~~~~~
/tmp/v8js/v8js_convert.cc: In function ‘v8::Local<v8::Value> v8js_hash_to_jsarr(zval*, v8::Isolate*)’:
/tmp/v8js/v8js_convert.cc:82:65: warning: ‘v8::Local<v8::Context> v8::Isolate::GetEnteredContext()’ is deprecated: Use GetEnteredOrMicrotaskContext(). [-Wdeprecated-declarations]
  v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
                                                                 ^
In file included from /opt/v8/include/v8-internal.h:14:0,
                 from /opt/v8/include/v8.h:25,
                 from /tmp/v8js/php_v8js_macros.h:52,
                 from /tmp/v8js/v8js_convert.cc:22:
/opt/v8/include/v8.h:8007:32: note: declared here
                 Local<Context> GetEnteredContext());
                                ^
/opt/v8/include/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/tmp/v8js/v8js_convert.cc:100:64: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
    newarr->Set(v8_context, index++, zval_to_v8js(data, isolate));
                                                                ^
In file included from /tmp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/v8js/v8js_convert.cc:22:
/opt/v8/include/v8.h:3330:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                     ^~~
/tmp/v8js/v8js_convert.cc: In function ‘v8::Local<v8::Value> zval_to_v8js(zval*, v8::Isolate*)’:
/tmp/v8js/v8js_convert.cc:152:48: warning: ‘v8::Local<v8::Context> v8::Isolate::GetEnteredContext()’ is deprecated: Use GetEnteredOrMicrotaskContext(). [-Wdeprecated-declarations]
       v8::Date::New(isolate->GetEnteredContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue);
                                                ^
In file included from /opt/v8/include/v8-internal.h:14:0,
                 from /opt/v8/include/v8.h:25,
                 from /tmp/v8js/php_v8js_macros.h:52,
                 from /tmp/v8js/v8js_convert.cc:22:
/opt/v8/include/v8.h:8007:32: note: declared here
                 Local<Context> GetEnteredContext());
                                ^
/opt/v8/include/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/tmp/v8js/v8js_convert.cc: In function ‘int v8js_to_zval(v8::Local<v8::Value>, zval*, int, v8::Isolate*)’:
/tmp/v8js/v8js_convert.cc:215:59: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>&)’
   v8::Maybe<bool> value = jsValue->BooleanValue(v8_context);
                                                           ^
In file included from /tmp/v8js/php_v8js_macros.h:52:0,
                 from /tmp/v8js/v8js_convert.cc:22:
/opt/v8/include/v8.h:2551:8: note: candidate: bool v8::Value::BooleanValue(v8::Isolate*) const
   bool BooleanValue(Isolate* isolate) const;
        ^~~~~~~~~~~~
/opt/v8/include/v8.h:2551:8: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
/tmp/v8js/v8js_convert.cc: In function ‘v8::Local<v8::Value> zval_to_v8js(zval*, v8::Isolate*)’:
/tmp/v8js/v8js_convert.cc:152:92: warning: ignoring return value of ‘bool v8::MaybeLocal<T>::ToLocal(v8::Local<S>*) const [with S = v8::Value; T = v8::Value]’, declared with attribute warn_unused_result [-Wunused-result]
       v8::Date::New(isolate->GetEnteredContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
Makefile:214: recipe for target 'v8js_convert.lo' failed
make: *** [v8js_convert.lo] Error 1

The checkout git checkout 6.4.388.18 had been outdaded, so I didn't execute it. And no errors has shown either, so I made the right chice.

@ready-fight
Copy link

@Dark-Aii Read this. It may help solve your problem and anyone elses:

Figured it out - wrong libv8 version:

checking for libv8_libplatform... found
checking for V8 version... 5.2.371
configure: WARNING: libv8 prior to 6.4.388.18 is missing speculative execution mitigations
My assumption was that leaving out the optional commands (from README.Linux.md) would build the latest v8 (7.5+ for ex.) - but that's not the case and it ends up building 5.2:

(optional) If you'd like to build a certain version:

git checkout 6.4.388.18
gclient sync
I've added the following commands and everything worked great (7.5.288.30 was latest stable via https://omahaproxy.appspot.com/ when I checked):

git checkout 7.5.288.30
gclient sync
Since v8js requires 6.9+ now maybe update the README.*.md's to direct users to install a version of v8 compatible with v8js? 6.9.427.18, 7.5.288.30 or otherwise?

Similar issue #421 from a couple days ago when trying to use the 6.4.388.18 version called out in README.Linux.md

@sss03
Copy link

sss03 commented Aug 13, 2019

@ss03 I'm familiar with this error, but don't know exactly what caused it. It's either your v8 version or you're not following the gist step by step. Make sure you get rid of all the pre-existing v8 versions and install the versions that I point out in the gist. Wish you lots of luck

Thanks a lot.
It worked.
I ran phpize command before ./configure LDFLAGS="-lstdc++" --with-v8js=/usr.
Hope it helps others.
Regards

@biey-root
Copy link

biey-root commented Mar 31, 2020

@Dark-Aii Read this. It may help solve your problem and anyone elses:

Figured it out - wrong libv8 version:

checking for libv8_libplatform... found
checking for V8 version... 5.2.371
configure: WARNING: libv8 prior to 6.4.388.18 is missing speculative execution mitigations
My assumption was that leaving out the optional commands (from README.Linux.md) would build the latest v8 (7.5+ for ex.) - but that's not the case and it ends up building 5.2:

(optional) If you'd like to build a certain version:

git checkout 6.4.388.18
gclient sync
I've added the following commands and everything worked great (7.5.288.30 was latest stable via https://omahaproxy.appspot.com/ when I checked):

git checkout 7.5.288.30
gclient sync
Since v8js requires 6.9+ now maybe update the README.*.md's to direct users to install a version of v8 compatible with v8js? 6.9.427.18, 7.5.288.30 or otherwise?

Similar issue #421 from a couple days ago when trying to use the 6.4.388.18 version called out in README.Linux.md

#For PHP 7.3
#use V8js version 2.1.1 instead of 2.1.0. and v8 version 7.5.288.30
git checkout 6.4.388.18 -> git checkout 7.5.288.30
git checkout 2.1.0 -> git checkout 2.1.1
#Tested on Ubuntu 18.04

Reference:
https://github.com/phpv8/v8js/releases/tag/2.1.1

@nadeemcrewlogix
Copy link

I'm facing issue to configuring v8js on mac and ubuntu 18

Can you help out to figure out this issue

checking how to allow c++11 narrowing... -Wno-c++11-narrowing
checking for libv8_libplatform... configure: error: could not find libv8_libplatform library

@KarimGeiger
Copy link

Just wanted to say thank you. After days of struggling with installing this shitload of a software, this is the first tutorial that finally worked. It even installed no problem on the M1 mac mini (using Rosetta2). You are my hero!

@jbrtsnts
Copy link

@KarimGeiger I'm on M1 mac mini as well stuck on

v8: Calling cellar in a bottle block is disabled! Use brew style --fix on the formula to update the style or use sha256 with a cellar: argument instead.

How do you manage to make it work? Thanks.

@KarimGeiger
Copy link

@jbrtsnts I didn't get that error message at all, so I don't know how to fix that. But I ran it using Rosetta 2, so prefixing every command with arch -x86_64 to run it on the x86 architecture, instead of ARM. Maybe that helps.

@jbrtsnts
Copy link

@KarimGeiger, I finally got it working. The formula is not working anymore, and only have to go with the latest version - 9.1.269.36 at the time of this comment. Thanks anyway for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment