DavidA Posted January 11, 2021 Report Share Posted January 11, 2021 Hi I build libsystemc.a (version 2.3.3) using the following CMake configuration on Centos 7 using gcc 7.3.1: cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/g++ -DCMAKE_POSITION_INDEPENDENT_CODE=True .. When I link to my C++ application on Centos 7 it links and runs fine. But when I link to the same libsystemc.a on Ubuntu 18.04 (which uses g++ 7.4.0) I get runtime link error: undefined symbol: _ZNK5sc_dt8sc_fxnum9to_stringB5cxx11ENS_9sc_numrepE ( sc_dt::sc_fxnum::to_string[abi:cxx11](sc_dt::sc_numrep) const ) Now in both cases the app is built with C++14 enabled. And I know that libsystemc.a uses C++14: nm -C <snip>/SystemC/rel-2.3.3/x64-linux/_release/libsystemc.a | grep sc_api_version 0000000000000850 T sc_core::sc_api_version_2_3_3_cxx201402L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201402L(sc_core::sc_writer_policy) So I don't know why the undefined symbol indicates '[abi:cxx11]'. Any idea why this is happening please? Quote Link to comment Share on other sites More sharing options...
Eyck Posted January 11, 2021 Report Share Posted January 11, 2021 You need to built the SystemC lib on ubuntu. With the introduction of small string optimization in C++11 gcc decided to move this into a different (inline) namespace (it is called DualABI). The use of of this can be configured at build time of gcc. Basically this is a decision of the distribution and may differ even if the version is the same. You may try to compile your SystemC code with '-D_GLIBCXX_USE_CXX11_ABI=0' or '-D_GLIBCXX_USE_CXX11_ABI=1'. See also https://gcc.gnu.org/wiki/Cxx11AbiCompatibility https://stackoverflow.com/questions/36159238/linking-problems-due-to-symbols-with-abicxx11 https://stackoverflow.com/questions/34571583/understanding-gcc-5s-glibcxx-use-cxx11-abi-or-the-new-abi HTH Quote Link to comment Share on other sites More sharing options...
DavidA Posted January 12, 2021 Author Report Share Posted January 12, 2021 Thanks for your reply - very helpful. Best regards, David Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.