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.83k stars 200 forks source link

"checking for V8 files in default path... not found" with v8 ppa #324

Closed ivoba closed 7 years ago

ivoba commented 7 years ago

Hi there, i used to build v8js with @pinepain s ppa.

add-apt-repository -y ppa:pinepain/libv8-5.2
apt-get install -y libv8-5.2-dev
pecl install v8js
echo extension=v8js.so > /etc/php/7.0/mods-available/v8js.ini \
  && ln -s /etc/php/7.0/mods-available/v8js.ini /etc/php/7.0/fpm/conf.d/99-v8js.ini \
  && ln -s /etc/php/7.0/mods-available/v8js.ini /etc/php/7.0/cli/conf.d/99-v8js.ini

Now trying the same with newer versions like libv8-6.1-dev and i receive:

running: phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 Please provide the installation prefix of libv8 [autodetect] : building in /tmp/pear/temp/pear-build-defaultuserSJmPV9/v8js-1.4.0 running: /tmp/pear/temp/v8js/configure --with-php-config=/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 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/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib checking for PHP extension directory... /usr/lib/php/20160303 checking for PHP installed headers prefix... /usr/include/php/20160303 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... 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... not found configure: error: Please reinstall the v8 distribution

There seem to have changed something, how can i fix this with ppa usage?

pinepain commented 7 years ago

Hi! After libv8-5.5 (or 5.4, can't recall) I install libv8 in /opt/libv8-x.y/{include,lib} which is probably why you get Please reinstall the v8 distribution error. I guess ./configure --with-v8js=/opt/libv8-6.1 or something like that should solve the issue.

@stesie i implemented this check in my ext's config.m4:

  V8_MIN_API_VERSION_STR=6.1.170

  DESIRED_V8_VERSION=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%s.%s", [$]1, [$]2;}'`

  # Path where v8 from packages we recommend are installed, it's /opt/libv8-MAJOR.MINOR on Ubuntu
  # and /usr/local/opt/v8@MAJOR.MINOR on macOS
  PRIORITY_SEARCH_PATH="/opt/libv8-${DESIRED_V8_VERSION} /usr/local/opt/v8@${DESIRED_V8_VERSION}"
  SEARCH_PATH="${PRIORITY_SEARCH_PATH} /usr/local /usr"

and it may also do a job for v8js.

ivoba commented 7 years ago

Thanks for your answer.
I tried now with

git clone https://github.com/phpv8/v8js.git 
cd v8js 
git checkout tags/1.4.0 
phpize 
./configure --with-v8js=/opt/libv8-6.1 
make 
make test 
make install 

and i get:

checking for libv8_libplatform... configure: error: could not find libv8_libplatform library

Did i do wrong?

pinepain commented 7 years ago

Make sure you install dev files and try master branch, looking briefly on commits history it looks like 1.4.0 does not work with 6.x. However, I don't use v8js, so I may not be accurate on that.

Anyway, it worked for me:

sudo add-apt-repository -y ppa:pinepain/libv8-6.1
sudo apt-get install libv8-6.1 libv8-6.1-dev
git clone https://github.com/phpv8/v8js.git 
cd v8js 
phpize 
./configure --with-v8js=/opt/libv8-6.1 
make 
make test
ivoba commented 7 years ago

ok ill try that, ill let you know.

with libv8-5.9 release 1.4.0 worked.

ivoba commented 7 years ago

yes with master banch it worked, as you have described above

apt-get install -y libv8-6.1 libv8-6.1-dev 
cd /tmp 
git clone https://github.com/phpv8/v8js.git 
cd v8js 
phpize 
./configure --with-v8js=/opt/libv8-6.1 
make 
make test 
make install 
echo extension=v8js.so > /etc/php/7.1/mods-available/v8js.ini 
ln -s /etc/php/7.1/mods-available/v8js.ini /etc/php/7.1/fpm/conf.d/99-v8js.ini 
ln -s /etc/php/7.1/mods-available/v8js.ini /etc/php/7.1/cli/conf.d/99-v8js.ini 
rm -rf /tmp/*

@pinepain Thanks a lot for your help and also for the PPAs :)

tanjhysj0 commented 6 years ago

my system is centos 6.5,how to install dev files and try master branch?

hadeswang2016 commented 6 years ago

all the answer is about ubuntu but my system is centos 7 how to install libv8-6.1 libv8-6.1-dev and

msacar commented 5 years ago

i was erroring like this libv8_libplatform... configure: error: could not find libv8_libplatform library then i tried /opt/remi/php71/root/bin/pecl install v8js and works