OCCI linkage error with gcc 5

依然范特西╮ 提交于 2019-12-06 15:49:53

This is almost certainly due to incompatibility between the new ABI in gcc 5 and the ABI expected by the OCCI libraries.

  • The OCCI libraries were apparently created using gcc 4.x
  • gcc 5 introduces a new ABI which includes, among other things, the "short string optimization" for std::string, and is compatible with C++11 (which disallows the reference-counted implementation of std::string used in gcc 4.x).

You can try #defining _GLIBCXX_USE_CXX11_ABI to 0 before building your code, which will cause gcc 5 to use the old ABI.

  • Note that EVERYTHING must be compiled with the same ABI to work together, so you may want to make that setting a global build flag. (E.g., with CMake, you would add -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" to the CMake command line).

Also, note that a similar problem exists when trying to build using OCCI with clang and its implementation of libc++ (http://libcxx.llvm.org/). (This is the one that bit me).

You can find out more at: https://gcc.gnu.org/gcc-5/changes.html#libstdcxx and https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

I had a similar problem in Solaris 11. It was resolved with Linker options:

-m64 -lCstd

I hope it helps.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!