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

fatal error: libplatform/libplatform.h: No such file or directory #include <libplatform/libplatform.h> #245

Closed laukaichung closed 8 years ago

laukaichung commented 8 years ago

Hi, I have been following these steps to compile v8js in CentOs 7. In fact, I'm also getting the same error in arch linux. Would you please help me figure out what is wrong with the compilation?

cd /tmp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
fetch v8
cd v8
make native library=shared -j8
chrpath -r '$ORIGIN' out/native/lib.target/libv8.so
sudo mkdir -p /tmp/v8-install/lib /tmp/v8-install/include
sudo cp out/native/lib.target/lib*.so /tmp/v8-install/lib/
sudo cp -R include/* /tmp/v8-install/include

echo -e "create /tmp/v8-install/lib/libv8_libplatform.a\naddlib out/native/obj.target/src/libv8_libplatform.a\nsave\nend" | sudo ar -M

cd /tmp
git clone https://github.com/preillyme/v8js.git
cd v8js
phpize
./configure --with-v8js=/tmp/v8-install

I'm getting errors during this step

./configure --with-v8js=/tmp/v8-install
make

Here is the errors:

/bin/sh /tmp/v8js/libtool --mode=compile g++ -Wno-narrowing -std=c++11 -I. -I/tmp/v8js -DPHP_ATOM_INC -I/tmp/v8js/include -I/tmp/v8js/main -I/tmp/v8js -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  -g -O2   -c /tmp/v8js/v8js_v8.cc -o v8js_v8.lo 
 g++ -Wno-narrowing -std=c++11 -I. -I/tmp/v8js -DPHP_ATOM_INC -I/tmp/v8js/include -I/tmp/v8js/main -I/tmp/v8js -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 -g -O2 -c /tmp/v8js/v8js_v8.cc  -fPIC -DPIC -o .libs/v8js_v8.o
/tmp/v8js/v8js_v8.cc:32:37: fatal error: libplatform/libplatform.h: No such file or directory
 #include <libplatform/libplatform.h>

My php package:

php70w.x86_64                           7.0.7-1.w7                     @webtatic
php70w-common.x86_64                    7.0.7-1.w7                     @webtatic
php70w-devel.x86_64                     7.0.7-1.w7                     @webtatic
python.x86_64                           2.7.5-34.el7                   @base    

gcc version:

gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) 
stesie commented 8 years ago

Sorry for not answering earlier ...

Does /tmp/v8-install/include/libplatform/libplatform.h exist?

What does the whole tmp/v8-install tree look like? Should be something like this (with different prefix of course):

stesie@hahnschaaf:~/Projekte/v8js-php7$ find /opt/v8/5.4.3-snap/
/opt/v8/5.4.3-snap/
/opt/v8/5.4.3-snap/lib
/opt/v8/5.4.3-snap/lib/libv8.so
/opt/v8/5.4.3-snap/lib/libicui18n.so
/opt/v8/5.4.3-snap/lib/libv8_libplatform.a
/opt/v8/5.4.3-snap/lib/libicuuc.so
/opt/v8/5.4.3-snap/include
/opt/v8/5.4.3-snap/include/v8-version.h
/opt/v8/5.4.3-snap/include/v8-testing.h
/opt/v8/5.4.3-snap/include/OWNERS
/opt/v8/5.4.3-snap/include/v8config.h
/opt/v8/5.4.3-snap/include/libplatform
/opt/v8/5.4.3-snap/include/libplatform/libplatform.h
/opt/v8/5.4.3-snap/include/v8-debug.h
/opt/v8/5.4.3-snap/include/v8-profiler.h
/opt/v8/5.4.3-snap/include/v8-platform.h
/opt/v8/5.4.3-snap/include/v8.h
/opt/v8/5.4.3-snap/include/v8-experimental.h
/opt/v8/5.4.3-snap/include/v8-util.h
/opt/v8/5.4.3-snap/share
/opt/v8/5.4.3-snap/share/v8
/opt/v8/5.4.3-snap/share/v8/snapshot_blob.bin
/opt/v8/5.4.3-snap/share/v8/natives_blob.bin

... maybe also check the output of configure for which V8 version it finds (and where), should look something like this:

checking for V8 version... 5.4.374
checking for libv8_libplatform.a... found in /opt/v8/5.4.374-snap//lib
checking whether V8 requires startup data... yes
checking for natives_blob.bin... found (/opt/v8/5.4.374-snap//share/v8/natives_blob.bin)
checking for snapshot_blob.bin... found (/opt/v8/5.4.374-snap//share/v8/snapshot_blob.bin)

... as your g++ call doesn't include some -I/tmp/v8-install/include I'd suppose it didn't pick up the one from /tmp but a different installation in /usr