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

Failed build with GCC 7 #294

Closed remicollet closed 7 years ago

remicollet commented 7 years ago

Which is default compiler in upcoming Fedora 26

libtool: compile:  g++ -Wno-narrowing -std=c++11 -I. -I/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS -DPHP_ATOM_INC -I/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/include -I/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/main -I/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS -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/usr -DHAVE_CONFIG_H -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c /builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_commonjs.cc  -fPIC -DPIC -o .libs/v8js_commonjs.o
In file included from /usr/include/dirent.h:245:0,
                 from /usr/include/php/Zend/zend_virtual_cwd.h:91,
                 from /usr/include/php/main/php.h:411,
                 from /builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/php_v8js_macros.h:39,
                 from /builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js.cc:18:
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_class.h: In function 'v8js_ctx* ```
v8js_ctx_fetch_object(zend_object*)':
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_class.h:92: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));
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_class.h:92:43: note: in expansion of macro 'XtOffsetOf'
  return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
                                           ^~~~~~~~~~
In file included from /builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/php_v8js_macros.h:52:0,
                 from /builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js.cc:18:
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_v8.h: At global scope:
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_v8.h:51:12: error: 'std::function' has not been declared
       std::function< v8::Local<v8::Value>(v8::Isolate *) >& v8_call TSRMLS_DC);
            ^~~~~~~~
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_v8.h:51:20: error: expected ',' or '...' before '<' token
       std::function< v8::Local<v8::Value>(v8::Isolate *) >& v8_call TSRMLS_DC);
                    ^
make: *** [Makefile:205: v8js.lo] Error 1
make: *** Waiting for unfinished jobs....
stesie commented 7 years ago

Hey @remicollet,

thanks for reporting. I've fixed the std::function thing, wrt. to the XtOffsetOf warning I don't yet know what it even means, to be honest :) ... yet it doesn't seem to matter much, the test suite fully passes (here)

Please try with latest php7 branch, if you use v8-devel from distro repo don't forget to pass --with-libdir=lib64 to ./configure

remicollet commented 7 years ago

I confirm v1.3.5 + fb26b5049c8acb0c21fdbf15303e442feabb300f = build ok on Fedora 26

Thanks for the quick fix.

(FYI, on my side I fix the [-Wwrite-strings] warning in http://git.php.net/?p=php-src.git;a=commitdiff;h=ec31924cd68df4f5591664d487baaba0d01b1daf)

stesie commented 7 years ago

Thanks for bringing this upstream.