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

pecl installation on Debian 10 #426

Closed supernovus closed 5 years ago

supernovus commented 5 years ago

So, Debian 10 has replaced libv8-dev with libnode-dev which has shifted the v8 include files into a new location. Now when you try to install using 'pecl install v8js' it pops up with this:

checking for V8 Javascript Engine... yes, shared
checking for V8 files in default path... not found
configure: error: Please reinstall the v8 distribution

Does anyone have a work-around for this?

supernovus commented 5 years ago

So, I cheated a little to get further than that, by symlinking the files in libnode-dev to the locations expected for the older libv8-dev package.

ln -s /usr/lib/x86_64-linux-gnu/libv8* /usr/lib/
ln -s /usr/include/nodejs/deps/v8/include/* /usr/include/

The configure stage passes now. However during the make stage, it comes across a lovely new error. I'll put the entire output of 'pecl install v8js' this time.

downloading v8js-2.1.1.tgz ...
Starting to download v8js-2.1.1.tgz (101,888 bytes)
.......................done: 101,888 bytes
28 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
Please provide the installation prefix of libv8 [autodetect] :
building in /tmp/pear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1
running: /tmp/pear/temp/v8js/configure --with-php-config=/usr/local/bin/php-conf
ig --with-v8js
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/m
ain -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/inc
lude/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-n
on-zts-20180731
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 1.1.1 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for V8 Javascript Engine... yes, shared
checking for V8 files in default path... found in /usr
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for C standard version... c++11
checking how to allow c++11 narrowing... -Wno-narrowing
checking for libv8_libplatform... found
checking for V8 version... 6.8.275.32-node.12
checking for natives_blob.bin... not found
checking for snapshot_blob.bin... not found
checking for v8::ArrayBuffer::Allocator::NewDefaultAllocator... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libra
ries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libr
aries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libr
aries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immedi
ate
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/libtool --mode=
compile g++ -Wno-narrowing -std=c++11 -I. -I/tmp/pear/temp/v8js -DPHP_ATOM_INC -
I/tmp/pear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/include -I/tmp/pear/temp
/pear-build-defaultuserSpoTDZ/v8js-2.1.1/main -I/tmp/pear/temp/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 -I/usr  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/v8js/v8js_array_ac
cess.cc -o v8js_array_access.lo
mkdir .libs
 g++ -Wno-narrowing -std=c++11 -I. -I/tmp/pear/temp/v8js -DPHP_ATOM_INC -I/tmp/p
ear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/include -I/tmp/pear/temp/pear-b
uild-defaultuserSpoTDZ/v8js-2.1.1/main -I/tmp/pear/temp/v8js -I/usr/local/includ
e/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/i
nclude/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/l
ib -I/usr -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/v8js/v8js_array_access.cc  -f
PIC -DPIC -o .libs/v8js_array_access.o
In file included from /usr/include/dirent.h:245,
                 from /usr/local/include/php/Zend/zend_virtual_cwd.h:76,
                 from /usr/local/include/php/main/php.h:466,
                 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(z
end_object*)':
/tmp/pear/temp/v8js/v8js_class.h:83:54: warning: offsetof within non-standard-la
yout type 'v8js_ctx' is conditionally-supported [-Winvalid-offsetof]
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
/tmp/pear/temp/v8js/v8js_class.h:83:43: note: in expansion of macro 'XtOffsetOf'
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
                                           ^~~~~~~~~~
/tmp/pear/temp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_en
umerator(const v8::PropertyCallbackInfo<v8::Array>&)':
/tmp/pear/temp/v8js/v8js_array_access.cc:213:63: 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]
    result->Set(isolate->GetEnteredContext(), i ++, V8JS_INT(j));
                                                               ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:3252:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                     ^~~
/tmp/pear/temp/v8js/v8js_array_access.cc:217:75: warning: ignoring return value
of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>
, v8::Local<v8::Value>)', declared with attribute warn_unused_result [-Wunused-r
esult]
  result->Set(isolate->GetEnteredContext(), V8JS_SYM("length"), V8JS_INT(i));
                                                                           ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_array_access.cc:17:
/usr/include/v8.h:3247:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^~~
/tmp/pear/temp/v8js/v8js_array_access.cc: In function 'void v8js_array_access_na
med_getter(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&)':
/tmp/pear/temp/v8js/v8js_array_access.cc:253:72: 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]
   prototype_object->Get(isolate->GetEnteredContext(), property).ToLocal(&ret_va
lue);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
~~~~
/bin/bash /tmp/pear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/libtool --mode=
compile g++ -Wno-narrowing -std=c++11 -I. -I/tmp/pear/temp/v8js -DPHP_ATOM_INC -
I/tmp/pear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/include -I/tmp/pear/temp
/pear-build-defaultuserSpoTDZ/v8js-2.1.1/main -I/tmp/pear/temp/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 -I/usr  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/v8js/v8js_class.cc
 -o v8js_class.lo
 g++ -Wno-narrowing -std=c++11 -I. -I/tmp/pear/temp/v8js -DPHP_ATOM_INC -I/tmp/p
ear/temp/pear-build-defaultuserSpoTDZ/v8js-2.1.1/include -I/tmp/pear/temp/pear-b
uild-defaultuserSpoTDZ/v8js-2.1.1/main -I/tmp/pear/temp/v8js -I/usr/local/includ
e/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/i
nclude/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/l
ib -I/usr -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/v8js/v8js_class.cc  -fPIC -DP
IC -o .libs/v8js_class.o
In file included from /usr/include/dirent.h:245,
                 from /usr/local/include/php/Zend/zend_virtual_cwd.h:76,
                 from /usr/local/include/php/main/php.h:466,
                 from /tmp/pear/temp/v8js/php_v8js_macros.h:42,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/tmp/pear/temp/v8js/v8js_class.h: In function 'v8js_ctx* v8js_ctx_fetch_object(z
end_object*)':
/tmp/pear/temp/v8js/v8js_class.h:83:54: warning: offsetof within non-standard-la
yout type 'v8js_ctx' is conditionally-supported [-Winvalid-offsetof]
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
/tmp/pear/temp/v8js/v8js_class.h:83:43: note: in expansion of macro 'XtOffsetOf'
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
                                           ^~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc: In function 'void v8js_free_storage(zend_obje
ct*)':
/tmp/pear/temp/v8js/v8js_class.cc:104:61: warning: ignoring return value of 'v8:
:Maybe<bool> v8::Object::Delete(v8::Local<v8::Context>, v8::Local<v8::Value>)',
declared with attribute warn_unused_result [-Wunused-result]
   V8JS_GLOBAL(c->isolate)->Delete(v8_context, object_name_js);
                                                             ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3337:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
                                     ^~~~~~
In file included from /usr/include/dirent.h:245,
                 from /usr/local/include/php/Zend/zend_virtual_cwd.h:76,
                 from /usr/local/include/php/main/php.h:466,
                 from /tmp/pear/temp/v8js/php_v8js_macros.h:42,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/tmp/pear/temp/v8js/v8js_class.cc: In function 'zend_object* v8js_new(zend_class
_entry*)':
/tmp/pear/temp/v8js/v8js_class.cc:241:43: warning: offsetof within non-standard-
layout type 'v8js_ctx' is conditionally-supported [-Winvalid-offsetof]
  v8js_object_handlers.offset = XtOffsetOf(struct v8js_ctx, std);
/tmp/pear/temp/v8js/v8js_class.cc:241:32: note: in expansion of macro 'XtOffsetO
f'
  v8js_object_handlers.offset = XtOffsetOf(struct v8js_ctx, std);
                                ^~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc: In function 'void zim_V8Js___construct(zend_e
xecute_data*, zval*)':
/tmp/pear/temp/v8js/v8js_class.cc:460:71: warning: ignoring return value of 'v8:
:Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::L
ocal<v8::Value>)', declared with attribute warn_unused_result [-Wunused-result]
  context->Global()->Set(context, V8JS_SYM("global"), context->Global());
                                                                       ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3247:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^~~
/tmp/pear/temp/v8js/v8js_class.cc:506:88: warning: ignoring return value of 'v8$
:Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context>, v8::Local<v8$
:Name>, v8::Local<v8::Value>, v8::PropertyAttribute)', declared with attribute $
arn_unused_result [-Wunused-result]
  V8JS_GLOBAL(isolate)->DefineOwnProperty(context, object_name_js, php_obj, v8:$
ReadOnly);

        ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3275:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
                                     ^~~~~~~~~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc:528:87: warning: ignoring return value of 'v8:
:Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context>, v8::Local<v8:
:Name>, v8::Local<v8::Value>, v8::PropertyAttribute)', declared with attribute w
arn_unused_result [-Wunused-result]
    php_obj->DefineOwnProperty(context, key, zval_to_v8js(value, isolate), v8::R
eadOnly);

       ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3275:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
                                     ^~~~~~~~~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc:595:94: warning: ignoring return value of 'v8:
:Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context>, v8::Local<v8
::Name>, v8::Local<v8::Value>)', declared with attribute warn_unused_result [-Wu
nused-result]
   php_obj->CreateDataProperty(context, method_name, ft->GetFunction(context).To
LocalChecked());

              ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3262:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> CreateDataProperty(Local<Context> context,
                                     ^~~~~~~~~~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc: In function 'int v8js_register_extension(zend
_string*, zend_string*, zval*, zend_bool)':
/tmp/pear/temp/v8js/v8js_class.cc:1070:29: error: cannot convert 'std::unique_pt
r<v8::Extension>' to 'v8::Extension*'
  v8::RegisterExtension(std::unique_ptr<v8::Extension>(extension));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:6226:45: note:   initializing argument 1 of 'void v8::Register
Extension(v8::Extension*)'
 void V8_EXPORT RegisterExtension(Extension* extension);
                                  ~~~~~~~~~~~^~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc: In function 'void v8js_write_property(zval*,
zval*, zval*, void**)':
/tmp/pear/temp/v8js/v8js_class.cc:1331:87: warning: ignoring return value of 'v8
::Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context>, v8::Local<v8
::Name>, v8::Local<v8::Value>, v8::PropertyAttribute)', declared with attribute
warn_unused_result [-Wunused-result]
   jsobj->DefineOwnProperty(v8_context, key, zval_to_v8js(value, isolate), v8::R
eadOnly);
       ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3275:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
                                     ^~~~~~~~~~~~~~~~~
/tmp/pear/temp/v8js/v8js_class.cc: In function 'void v8js_unset_property(zval*,
zval*, void**)':
/tmp/pear/temp/v8js/v8js_class.cc:1355:31: warning: ignoring return value of 'v$::Maybe<bool> v8::Object::Delete(v8::Local<v8::Context>, v8::Local<v8::Value>)'$ declared with attribute warn_unused_result [-Wunused-result]
  jsobj->Delete(v8_context, key);
                               ^
In file included from /tmp/pear/temp/v8js/php_v8js_macros.h:52,
                 from /tmp/pear/temp/v8js/v8js_class.cc:22:
/usr/include/v8.h:3337:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
                                     ^~~~~~
make: *** [Makefile:210: v8js_class.lo] Error 1
ERROR: `make' failed
supernovus commented 5 years ago

So this is a simple case, the version of libnode provided by Debian 10 is for the LTS release of Node.js which has a version of libv8 which is too old to work with this extension. Only solutions I can see are either installing from source, or back porting a newer version of the library. Closing this issue as it's irrelevant.