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

Linking error when building on CentOS #224

Closed chazmuzz closed 8 years ago

chazmuzz commented 8 years ago

I see that you frequently get questions on installation, so apologies for the repetitiveness. However I couldn't find any help from the closed issues.

I am attempting to install v8 and v8js from source using the instructions in https://github.com/phpv8/v8js/blob/master/README.Linux.md

My system is CentOS 7.2.1511 I have PHP 5.6.19 I have g++ version 4.8.5 I am using the v8 tag 5.1.256, because I saw that recommended in another issue.

I am getting the following error at the top of make test. After failing to load the extension, all of the tests are skipping.

Warning: PHP Startup: Unable to load dynamic library '/tmp/v8js/modules/v8js.so' - libv8.so: cannot open shared object file: No such file or directory in Unknown on line 0

I have tried building with snapshot=on and snapshot=off, but I'm getting the same error each time.

libv8.so and libv8_libplatform.a both exist in /usr/lib/

Here is my config.log https://gist.github.com/chazmuzz/097f45bff04c2d8915719dbb53229283

chazmuzz commented 8 years ago

I see in my config.log that prefix=/usr/local, but libv8.so is in /usr/lib. Is that the problem?

stesie commented 8 years ago

The config.log link 404s for me

Could you please ldd /tmp/v8js/modules/v8js.so which file actually it isn't finding

chazmuzz commented 8 years ago

Here is the output

[/tmp/v8js]# ldd /tmp/v8js/modules/v8js.so
    linux-vdso.so.1 =>  (0x00007fff431fe000)
    libv8.so => not found
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7b9050e000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7b9014d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7b90959000)
chazmuzz commented 8 years ago

I suppose it's looking in the wrong place for libv8.so

stesie commented 8 years ago

I don't know CentOS well enough but isn't /usr/lib/ the directory for 32-bit libraries there whereas 64-bit libraries are installed to /usr/lib64/?

chazmuzz commented 8 years ago

@stesie yes, that was the problem. Moving the libv8* libs to /usr/lib64 solves the linking problem. Thanks!

I copied and pasted the commands out of README.Linux.md. The libv8 binaries are moved to /usr/lib. Is that supposed to be /usr/lib64 for all 64-bit linux systems?

stesie commented 8 years ago

... no unfortunately not. On Debian & Ubuntu it's still /usr/lib, even for 64-bit systems