Skip to content

v8js: v8js.so: undefined symbol: _ZSt25__throw_bad_function_callv in Unknown on line 0 #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
serenityzn opened this issue Jan 25, 2016 · 10 comments

Comments

@serenityzn
Copy link

Hello,

I have compiled v8js (0.4.1 version) following README.Linux instructions.
Everything compiled fine but when php trying to load v8js extension it returns me an error:
PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/v8js.so' - /usr/lib64/php/modules/v8js.so: undefined symbol: _ZSt25__throw_bad_function_callv in Unknown on line 0

System: Centos 6.6.
V8 version: 4.3.9 (build string: make native library=shared snapshot=off -j8)
GCC version: gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Also I have tried to install via pecl: installed succesfully but the same error when php tried to load extension.

I will be grateful for help.
Thank you in advance,
Volodymyr

@stesie
Copy link
Member

stesie commented Jan 25, 2016

Have you checked whether V8 as compiled by you is working? e.g. by running some of their sample scripts like out/native/hello-world or out/native/shell

_ZSt25__throw_bad_function_callv is the mangled name for std::__throw_bad_function_call() symbol which should be exported by libstdc++

https://stackoverflow.com/questions/12942538/undefined-symbol-std-throw-bad-function-call might be related

Do you have multiple c++ library versions around? Or just some normal Centos installation?

@serenityzn
Copy link
Author

Yes I have cheked V8 - it's working fine:
v8]# out/native/shell
V8 version 4.3.9 [sample shell]

print('hello world');
hello world

Yes I have multiple c++ libraries. I have installed devtoolset-2 with gcc 4.8.2. and used them to build v8 and v8js. But system GCC version is 4.4.7.

@Enase
Copy link

Enase commented Jan 26, 2016

Hi guys, I have the same troubles. Any suggestion is very welcome!
Thanks in advance.

@stesie
Copy link
Member

stesie commented Jan 26, 2016

@Enase you're on Centos as well?

@Enase
Copy link

Enase commented Jan 26, 2016

cat /etc/centos-release
CentOS release 6.7 (Final)

@Enase
Copy link

Enase commented Jan 27, 2016

@stesie pls, let me know if you need any additional info.

@stesie
Copy link
Member

stesie commented Jan 27, 2016

@Enase sure I'll let you know. Unfortunately I haven't found time to set up a CentOS box yet

@stesie
Copy link
Member

stesie commented Feb 7, 2016

Sorry for the late reply, but I finally found some time to spend on CentOS - after all it was a little bit more involved than I expected initially but ...

First of all I tried with a more recent version of CentOS (7.2) without any major issue

Then I tried CentOS 6.7 with python 2.7 (for the V8 build process) + devtoolset-2 as mentioned by both of you... and finally able to reproduce the problem both of you have.

The problem is that the base system's libstdc++.so is pretty old and lacks support for recent C++ features (which are used by php-v8js however). The devtoolset-2 package ships a libstdc++.so linker script that uses the base system's version and augments its with a static library that has the other stuff.

The linker script /opt/rh/devtoolset-2/root/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libstdc++.so says

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared )

The base library /usr/lib64/libstdc++.so.6 doesn't have the symbol missing (from above):

[root@2ced09d8fe23 php-5.5.32]# nm -D /usr/lib64/libstdc++.so.6 | grep _ZSt25__throw_bad_function_callv

however the extra library has it:

[root@2ced09d8fe23 php-5.5.32]# nm /opt/rh/devtoolset-2/root/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libstdc++_nonshared.a  | grep _ZSt25__throw_bad_function_callv
0000000000000000 T _ZSt25__throw_bad_function_callv

... for normal programs this is no problem, the linker just links the necessary stuff from the static library right into the program and uses the shared library for the rest.

With v8js this is a problem however as it isn't linked as a program but as a shared library itself ... and therefore the symbols from the static library are not linked in.
... and the PHP binary itself was compiled earlier (by the package distributor) of course not linking in those symbols as well.

A solution to the problem would be statically linking v8js into php itself (i.e. recompile php and do the static linking mentioned above); I just tried that and confirm it working.

hope that helps :-)

~stesie

@Enase
Copy link

Enase commented Feb 10, 2016

Thanks, it works for me.

@rosmo
Copy link

rosmo commented Mar 5, 2016

Hey @Enase, you could also try the RPM specs for EL6 and EL7 for newer V8s: https://github.com/rosmo/v8-rpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants