CentOS 7 PHP7.4环境安装v8与v8js扩展报错解决方案求助
CentOS7 环境安装PHP7.4 v8js扩展报错说明
我们尝试在服务器上安装v8js扩展,具体情况如下:
服务器基础配置
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-042stab141.3
Architecture: x86-64
服务器运行PHP 7.4版本,我们尝试了网上公开的多种安装方法,包括通过WHM安装均出现报错,操作过程如下:
(终端执行操作)
ea-php74-pecl install v8js
首次安装v8js报错日志
downloading v8js-2.1.2.tgz ... Starting to download v8js-2.1.2.tgz (102,977 bytes) ........................done: 102,977 bytes 28 source files, building running: phpize Configuring for: PHP Api Version: 20190902 Zend Module Api No: 20190902 Zend Extension Api No: 320190902 Please provide the installation prefix of libv8 [autodetect] : building in /root/tmp/pear/pear-build-rootl3thYo/v8js-2.1.2 running: /root/tmp/pear/v8js/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config --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 pkg-config... /bin/pkg-config checking pkg-config is at least version 0.9.0... yes 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 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... /opt/cpanel/ea-php74/root/usr checking for PHP includes... -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib checking for PHP extension directory... /opt/cpanel/ea-php74/root/usr/lib64/php/modules checking for PHP installed headers prefix... /opt/cpanel/ea-php74/root/usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for gawk... gawk checking for V8 Javascript Engine... yes, shared checking for V8 files in default path... found in /usr/local 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... checking for libv8_libplatform... configure: error: could not find libv8_libplatform library ERROR: `/root/tmp/pear/v8js/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config --with-v8js' failed
我们也尝试执行ea-php74-pecl install v8命令,输出日志如下:
安装v8扩展报错日志
downloading v8-0.2.2.tgz ... Starting to download v8-0.2.2.tgz (199,055 bytes) ....................done: 199,055 bytes 122 source files, building running: phpize Configuring for: PHP Api Version: 20190902 Zend Module Api No: 20190902 Zend Extension Api No: 320190902 building in /root/tmp/pear/pear-build-root1CuGGg/v8-0.2.2 running: /root/tmp/pear/v8/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config 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 pkg-config... /bin/pkg-config checking pkg-config is at least version 0.9.0... yes 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 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... /opt/cpanel/ea-php74/root/usr checking for PHP includes... -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib checking for PHP extension directory... /opt/cpanel/ea-php74/root/usr/lib64/php/modules checking for PHP installed headers prefix... /opt/cpanel/ea-php74/root/usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for gawk... gawk checking for V8 Javascript Engine... yes, shared checking Check for supported PHP versions... supported (7.4.25) checking for V8 files in default path... found in /usr checking for ICU data file icudtl.dat... checking for V8 version... cat: /usr/include/v8-version.h: No such file or directory cat: /usr/include/v8-version.h: No such file or directory cat: /usr/include/v8-version.h: No such file or directory cat: /usr/include/v8-version.h: No such file or directory cat: /usr/include/v8-version.h: No such file or directory /root/tmp/pear/v8/configure: line 4081: test: -gt: unary operator expected /root/tmp/pear/v8/configure: line 4082: test: -gt: unary operator expected .. configure: error: libv8 must be version 6.6.313 or greater ERROR: `/root/tmp/pear/v8/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config' failed
我们已经花费多日尝试解决该问题,恳请各位提供可行解决方案。
补充更新
我们此前参考了网上公开的第三方教程以及官方文档的操作步骤。后续我们通过将v8官方仓库的include目录内容添加到服务器,解决了libv8_libplatform库找不到的报错,但再次执行ea-php74-pecl install v8js命令时,出现了新的报错:
ea-php74-pecl install v8js
最新报错日志
downloading v8-0.2.2.tgz ... Starting to download v8-0.2.2.tgz (199,055 bytes) ...........done: 199,055 bytes 122 source files, building running: phpize Configuring for: PHP Api Version: 20190902 Zend Module Api No: 20190902 Zend Extension Api No: 320190902 building in /root/tmp/pear/pear-build-rootZge4Us/v8-0.2.2 running: /root/tmp/pear/v8/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config 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 pkg-config... /bin/pkg-config checking pkg-config is at least version 0.9.0... yes 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... configure: error: in `/root/tmp/pear/pear-build-rootZge4Us/v8-0.2.2': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details ERROR: `/root/tmp/pear/v8/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config' failed
内容的提问来源于stack exchange,提问作者Starstruc8
相关产品推荐
相关产品推荐

