fredric
fredric

Reputation: 63

gcc 6.1 executable file link error

I recently bootstrapped gcc 6.1 to my ubuntu based linux distribution. Seemingly it installed properly because I can compile programs written in C and C++. I can also run the compiled executables. I can also compile a program that includes C++11 and C++14 features without any errors but when I try to run these executable I get the following error;

./exec: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./ardi)

when I run;

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIB

the list does not include the needed file. Does it mean gcc 6.1 has those files somewhere else. How can I locate needed files and redirect gcc. I am new to linux system and not even sure I understand the error correctly.

Upvotes: 1

Views: 146

Answers (1)

user2807083
user2807083

Reputation: 2982

I think this is because your host libstdc++ library is older than one from your new g++. So you can try to use static linking to avoid external dependency from newer std lib version using -static-libstdc++ g++ flag. The cost of this solution is increased size of resulting executables.

Upvotes: 1

Related Questions