v8js: Error: could not find libv8_libplat form library - Installing v8JS PHP extension
I’m trying to install php v8js extension but stuck with an issue:
Here is the terminal data:
downloading v8js-2.0.0.tgz ...
Starting to download v8js-2.0.0.tgz (101,564 bytes)
.......................done: 101,564 bytes
28 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Please provide the installation prefix of libv8 [autodetect] :
building in /tmp/pear/temp/pear-build-rootDcjzlc/v8js-2.0.0
running: /tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --w
ith-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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr
/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/inclu
de/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate
PHP parsers.
checking for gawk... gawk
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...
checking for libv8_libplatform... configure: error: could not find libv8_libplat
form library
ERROR: /tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --wi
th-v8js' failed
Can you please help me.
Thanks in advance, cheers
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 24 (3 by maintainers)
@noogen thank you a lot, it really helped. Finally I installed v8js on macOS Mojave with PHP 7.3.
Here are steps I followed, It could help to others:
Installing v8
brew install v8.rbmkdir -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/libInstalling v8js extension
git clone https://github.com/phpv8/v8jscd v8js$phpize$./configure CXXFLAGS="-Wno-c++11-narrowing" --with-v8js="/usr/local/Cellar/v8/7.4.288.25/libexec"$make$make test$make installEnabling v8js in PHP
php.inifile: $php --iniConfiguration File (php.ini) Path: /usr/local/etc/php/7.3 Loaded Configuration File: /usr/local/etc/php/7.3/php.ini Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d Additional .ini files parsed: /usr/local/etc/php/7.3/conf.d/ext-opcache.iniphp.inifile: $nano /usr/local/etc/php/7.3/php.inibrew services restart php@Jiri-Mihal that’s because the latest v8 (7.5.288.22) from homebrew deprecated a bunch of stuff. I tested latest v8 (7.5.288.22) on Mojave and got the same error as you.
Try uninstall your v8
brew uninstall v8, save this file (formula for v8 7.4.288.25) locally https://raw.githubusercontent.com/Homebrew/homebrew-core/0a6171330678879285f2c566db9349da421d6f62/Formula/v8.rb and runbrew install v8.rbNote, I’ve also successfully compile phpv8/v8js on latest macOS Mojave 10.14.5 and php 7.3.6 using v8 7.4.288.25
Instruction how I got it to work:
brew install v8libdir so I mirror the linux directory structure like so: https://github.com/niiknow/docker-hostingbase/tree/master/rootfs/opt/libv8-7.4Above are instructions from my MacBook Pro 15 (mid 2015), macOS High Seria 10.13.6, php 7.2, Homebrew 2.1.3
NOTE: I’ve historically compile v8js on linux. I never had a need to build v8 on macOS so I never tried. Once @palfaro91 hinted of
v8on macOS homebrew. Took me 5 minutes to figure and tested the instruction above. Pretty straight forward steps. I’m amazed there wasn’t any hiccup/trouble like it usually do when you try anything the first time.For me had to execute below commands as well
@Jiri-Mihal you made my day !
@palfaro91 I’m having a similar issue, please comment if you find a solution. I’ll do the same, but i’m losing all hope after 3 days of bashing my head against a wall At the moment I’m stuck on
@Jiri-Mihal thank you so much, I was dying on my keyboard, watching V8js compilation errors…
@palfaro91 Actually, I meant to give kudos the author on having it working for macOS. It’s because I also had a tough time, in the past, trying to build on linux - especially with php 7.3; that I decided not to even try on my macOS. Since I’m familiar with docker, I just do all related work inside of docker.
Anyway, instruction is pretty old and it said to checkout version 3.32.6. If you look at older version of v8, you will find a
Makefileexample: https://github.com/v8/v8/tree/4.2-lkgrIn newer version, we use python tools to build, hence no more
Makefilein master: https://github.com/v8/v8You can look here if you’re interested in full build script (in linux) - https://github.com/niiknow/docker-hostingbase/blob/master/v8build/Dockerfile#L38
So far I can only guess what you’re doing, since you haven’t said much regarding your setup (apart from some package version numbers available from screen output).
So you seem to have some PHP 5.5 around (otherwise paths like
/usr/lib/php5/20121212wouldn’t be in the output). Since you seem to be on Ubuntu “trusty” (14.04 pops up multiple times), you likely have “php5-dev” installed – which you actually shouldn’t as you say you’d like to play around with php7.1So there’s also the package version
7.1.16-1+ubuntu14.04.1+deb.sury.org+1mentioned above, which seems to relate to Ondrejs packages. Since Ondrej wants to allow parallel installation of multiple PHP versions you need to be extra careful if you actually do so.So to me it seems like
phppoints to some PHP 7.1, yourpeclscript above to PHP 5.5, then you likely have some/usr/bin/phpizewhich is PHP 5.5 and some/usr/bin/phpize7.1which is PHP 7.1, same for/usr/bin/php-configvs./usr/bin/php-config7.1Which version of V8 do you have installed? And particularly where to?
That all being said, you’ll likely want to continue like this (if you really need the version mess):
… you can leave off the path to libv8 if it is installed to /usr (i.e. /usr/include and /usr/lib)
Mind how the correct version of phpize and php-config are referenced