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

natives_blob.bin - not found #264

Closed rbro closed 7 years ago

rbro commented 8 years ago

I am running CentOS 7 and followed the instructions in README.Linux.md to compile v8. When I try to compile v8js 1.3.2, I'm getting a configure error:

checking for natives_blob.bin... not found
configure: error: Please provide V8 native blob as needed
ERROR: `/tmp/pear/temp/v8js/configure --with-php-config=/usr/local/bin/php-config --with-v8js=/opt/v8' failed

I'm not seeing a file called natives_blob.bin in my v8 directory.

Can you please let me know how to generate this file? I tried installing 1.3.1 instead and the configure worked, but I got a different error during compiling which I believe already was resolved in another issue:

make: *** No rule to make target `/tmp/pear/temp/v8js/v8js_generator_export.cc', needed by `v8js_generator_export.lo'.  Stop.
ERROR: `make' failed

Thanks for your help.

stesie commented 8 years ago

could you please provide the config.log file contents here

And yes, the latter issue should be fixed meanwhile.

rbro commented 8 years ago

Yes, attached is my config.log.

config.log.txt

stesie commented 8 years ago

the problem is this one

configure:5141: g++ -o conftest -g -O2 -I/opt/v8/include -std=c++11 -I/opt/v8 -Wl,--rpath=/opt/v8/lib -L/opt/v8/lib conftest.cpp -lv8  /opt/v8/lib/libv8_libplatform.a /opt/v8/lib/libv8_libbase.a >&5
g++: error: /opt/v8/lib/libv8_libbase.a: No such file or directory

... it tries to link libv8_libbase.a which apparently doesn't exist, and it even found that out:

configure:5073: checking for libv8_libplatform.a
configure:5084: result: found in /opt/v8/lib
configure:5073: checking for libv8_libbase.a

... but it isn't necessarily needed. Need to check back and try to reproduce (on some other box)

stesie commented 8 years ago

Just uploaded version 1.3.3 to PECL that should have that sorted out

rbro commented 8 years ago

Thanks for the quick fix. I confirm it's resolved.

Jan-E commented 8 years ago

Just uploaded version 1.3.3 to PECL that should have that sorted out

@stesie Could you adjust the version number in this repo? It still shows as 1.3.2

steezeburger commented 8 years ago

I'm getting the same errors on MacOS.

Downloading 1.3.3 from PECL's website and refollowing the instructions, I still get the same errors about missing libv8_libbase.a, libv8_libplatform.a, and natives_blob.bin.

Any ideas?

http://hastebin.com/uwutaboson.makefile config.log if interested

Edit: I had to manually copy v8/out/natives_blob.bin and v8/out/snapshot_blob.bin to /usr/local/lib and it seemed to work.

several27 commented 8 years ago

I have this problem as well, missing "out/native/obj.target/src/libv8_libplatform.a" file.

@steezeburger natives_blob.bin and snapshot_blob.bin are missing from out directory as well.

stesie commented 8 years ago

@Jan-E sure, sorry for messing this up

stesie commented 8 years ago

@steezeburger I'm a bit unsure/confused, does it work for you now or doesn't it?

I agree that the error message might be misleading, it always complains about missing natives_blob.bin if it isn't able to successfully compile and run a minimalist V8. The problem is that libv8_libbase.a isn't needed on all systems (but some, e.g. MacOS and NixOS Linux need it, Ubuntu Linux doesn't) ... yet libv8_libplatform.a seems to be needed on any platform.

Whether blobs are needed depends on compile flags with V8 itself. It's kindof imposible to detect without just trying and guessing.

So I could change configure to

sounds good?

@several27 which version of V8 are you using?

steezeburger commented 8 years ago

@stesie The last command I was able to run was the ./configure CXXFLAGS="-Wno-c++11-narrowing"

make then fails due to too many errors and warnings

Edit: I believe my errors when running make are from not being on PHP7. I'm currently on 5.6 but will hopefully be upgrading soon for other reasons and to test this.

mikemherron commented 7 years ago

@stesie Just FYI I am experiencing the same issue as @several27, the libv8_libplatform.a is not generated when building v8, causing the configure command to fail. I'm using V8 5.7.27.

Jan-E commented 7 years ago

@mikemherron Smells like the same problem that Windows users are experiencing for every V8 version > 5.1. Ref: http://stackoverflow.com/q/38674676/872051

On Windows you can solve that by

cd obj\v8_libplatform && lib /out:v8_libplatform.lib .obj cd obj\v8_libbase && lib /out:v8_libbase.lib .obj

See my comments in https://github.com/phpv8/v8js/blob/php7/config.w32#L47 I guess there is a comparable link statement on *nix.

stesie commented 7 years ago

@mikemherron I've now changed config.m4 to pick up libv8_libplatform.so file generated by V8 5.6+

Also fixed that v8js doesn't try to "guess" whether blobs are needed or not. It just uses them, if they are installed along with the libv8.so file.

mikemherron commented 7 years ago

That's great, will try this out over the next few days, thanks.

sturdynut commented 7 years ago

Hello,

I'm running into a very similar issue on CentOS 7. I'd be happy to open a new ticket, but since the errors were nearly identical I figured they were related.

Here is the error from the config.log file: configure:5069: error: could not find libv8_libplatform library

Here's what I did:

I've installed v8 via:

Then I went to install v8js via:

Here is the error from running the make commands: make: *** No rule to make target '/usr/local/git-installs/v8js/v8js_generator_export.cc', needed by 'v8js_generator_export.lo'. Stop.

I've attached my config.log

...any ideas? Thanks for the help!! 🙏

config.log.txt

stesie commented 7 years ago

@sturdynut don't comment on closed tickets, especially not without re-opening them. This is like relying on me to have notifications turned on and handle those (which many tend to not do)

Anyways, regarding your question

... are you really using a fresh checkout? config.log lets me doubt that, since it doesn't seem to do the checks from #301 (which would be needed)

sturdynut commented 7 years ago

@stesie - I'm going to give 5.9.40 a try. I'll let you know if that resolved my problem. Thank you! I was in a rush when I commented, you are right though, thanks!

sturdynut commented 7 years ago

I'm now getting this: checking for libv8_libplatform... checking for libv8_libplatform... configure: error: could not find libv8_libplatform library.

I rebuild v8 using 5.9.40 and am using the master branch from v8js.

I checked my /opt/v8 directory and that file is there.

screen shot 2017-04-18 at 8 41 03 am

sturdynut commented 7 years ago

I'm going to try this again using php7, I shouldn't be using php 5.6 anyways. I think things should go smoothly with 7. [fingers crossed]

stesie commented 7 years ago

Yes, #301 wasn't fixed for PHP5, so if you've tried with it before (your comment above implicitly told otherwise) this would be expected

sturdynut commented 7 years ago

That was my problem. It worked like a charm with php7. This can be closed, thank you.