0

I have a c++ code that is written and compile on my PC and executed on a remote server. I changed recently my pc ans so set up everything uptodate on it. But now execution of my code on the unchanged server failed with this error:

./ReactionThermo: relocation error: ./ReactionThermo: symbol _ZTINSt8ios_base7failureB5cxx11E, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference

I look a bit on the web and it appears to be gcc fault. And indeed it's on my pc 5.4 and 4.8 on my server. I tried to upgrade it but got following error:

sudo apt-get install gcc-4.9 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 gcc-4.9 : Depends: cpp-4.9 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
           Depends: libgcc-4.9-dev (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
 munge : Depends: libmunge2 (= 0.5.11-1ubuntu1) but 0.5.11-1ubuntu1.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I tried the apt-get -f install comand but it's not improving thinks.

Any ideas.

Thanks

PS: I knoz it's look like GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference but I don't want tu downgrade cpp, rather to upgrade it

Laetis
  • 1,337
  • 3
  • 16
  • 28
  • Possible duplicate of [GLIBCXX\_3.4.21 not defined in file libstdc++.so.6 with link time reference](https://stackoverflow.com/questions/36816570/glibcxx-3-4-21-not-defined-in-file-libstdc-so-6-with-link-time-reference) – underscore_d Oct 23 '17 at 13:53
  • or [apt: relocation error: version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference](https://askubuntu.com/questions/777803/apt-relocation-error-version-glibcxx-3-4-21-not-defined-in-file-libstdc-so-6) – underscore_d Oct 23 '17 at 13:53

1 Answers1

0

In general, you need to build C/C++ binaries on the oldest operating system version you want to support, using the system compiler (or other vendor-supported compilers such as the Toolchain Module for SUSE Linux Enterprise Server or Developer Toolset for Red Hat Enterprise Linux). You cannot compile your program on a newer system and copy it to a different environment with an older (or different) operating system release. In simple cases, it might work, but in other cases, you will get dynamic linker failures at run time (like you did), or even silent data corruption.

Furthermore, you should look at build tools such as pbuilder and mock to automate building your software in a well-defined build environment.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92