Background: I'm writing an extension to PHP in C and C++, using boost libraries. The C extension-hooks call into some extern "C"'ed C++ code.
I'm getting my_extension.so: undefined symbol: _ZNKSt13runtime_error4whatEv in Unknown on line 0
What I thought was happening (and I could be wrong) is an exception in C++ code is getting thrown back at the C code that is calling it, and thus choking. Though I'm not sure because I just went and wrapped all the C++ code with try/catch(...) and this is still happening.
The other thing is I do not get this error on CentOS 5.6, but I do get it on CentOS 6.5, even compiling this extension on 6.5. I did build the php from sources on 6.5, so maybe I'm missing a library? Php otherwise works fine.
I have no idea how to troubleshoot this, as PHP decides not to load this library and then keeps running. gdb doesn't even catch it.
Here is the exact error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/my_extension.so' - /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/my_extension.so:
undefined symbol: _ZNKSt13runtime_error4whatEv in Unknown on line 0
edit If I link my extension to a simple executable with a main() and call some of the C++ methods I have, it works fine.
ldd is showing a dependency on libstdc++.so in my test executable, but not in my shared library my_extension.so. I don't know how to make it have this dependency in the .so
edit 2
I found the shared library is getting put together by cc rather than g++. If I manually make the shared library with g++, everything works.
# cc -shared src/.libs/all_my_dot_o_files.o -Wl,-soname -Wl,my_extension.so -o .libs/my_extension.so
vs.
# g++ -shared src/.libs/all_my_dot_o_files.o -Wl,-soname -Wl,my_extension.so -o .libs/my_extension.so
So I just need to figure out how to make this php autoconf cr@p use g++ instead of cc.