Topic: error installing v8js

I am running CentOS 7 with PHP 7.2.  I tried to install v8js with "pecl install v8js", but got a few errors listed below about missing __builtin_saddl_overflow and __builtin_ssubl_overflow.  I found https://github.com/CopernicaMarketingSo … issues/381 which said to comment out lines in /usr/include/php/main/php_config.h.  That seemed to work and allowed me to install it, but is there a better way to do this?

Thanks for your help.

Ryan

-------

/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
                                                                    ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)':
/usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
                                                                    ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

Re: error installing v8js

You need to build with the same compiler than PHP, so with GCC 7 (available in devtoolset-7)

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: error installing v8js

Thanks, I tried installing devtoolset-7, but still getting the same error.  I'm running into https://bugs.php.net/bug.php?id=75852.  Is the workaround to download/compile manually rather than do "pecl install"?

Re: error installing v8js

Can you please try to update php-pear using
https://rpms.remirepo.net/enterprise/7/ … -pear.html

Which includes fix from https://github.com/pear/pear-core/pull/88

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: error installing v8js

Yes, that fixed it.  Thanks for making that update.

Re: error installing v8js

Actually maybe not.  It compiled/installed fine, but when I try to run php over cli now, I get the below:

Warning: PHP Startup: Unable to load dynamic library 'v8js' (tried: /usr/lib64/php/modules/v8js (/usr/lib64/php/modules/v8js: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/v8js.so (/usr/lib64/php/modules/v8js.so: undefined symbol: _ZTINSt6thread6_StateE)) in Unknown on line 0

It works fine if I download/compile manually.

Re: error installing v8js

Sorry, that error is unrelated.  I got it working now.  I had compiled v8js manually with:

./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++"

This was from https://github.com/phpv8/v8js/blob/php7 … .Linux.md.

If I set LDFLAGS="-lstdc++" before running pecl install, then it works.