Reputation: 31
I compiled the below code on the compilation machine with mentioned configuration. The compilation was successful. But got the above error on executing ldd -r my_executable
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> mylist;
mylist.push_back(1);
mylist.push_back(2);
mylist.push_back(3);
cout << "\nList:\n";
for(list<int>::iterator it = mylist.begin(); it != mylist.end(); it++)
{
cout << *it << "\n";
}
}
Compiling machine details: glibc version 2.14.1 libstdc++ version GLIBCXX_3.4.16 (output after running command : strings /usr/lib/libstdc++.so.6 | grep LIBCXX )
Target machine details: glibc version 2.12.90 libstdc++ version GLIBCXX_3.4.14 (output after running command : strings /usr/lib/libstdc++.so.6 | grep LIBCXX )
Upvotes: 3
Views: 2959
Reputation: 171283
You have built your program on a machine with one version of GCC and so your program depends on the shared libraries from that version of GCC, then you are trying to run it on a machine with an older version of GCC, which does not have the necessary shared libraries.
There are hundreds of answers about this on StackOverflow already. The simplest answer is to just build the program on the target machine, so it is built with the version of GCC that exists on the target machine.
Upvotes: 1