d_w
d_w

Reputation: 11

How to manually set which version 'libstdc++.so.6' used instead of using the latest one?

I got an error on my server.

version `GLIBCXX_3.4.21' not found

After I some investigation I found that 'libstdc++.so.6' version used when build the app on my local computer is much advanced than on server. So I got that error because that version is not available on server. From what I read, I can fixed that by upgrade 'libstdc++.so.6' on server to the latest one but I can't do that because the restricted acces. Is there any way to downgrade or make my local use older version as default?

Upvotes: 0

Views: 1262

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136415

When linking your application specify -Wl,-rpath=$ORIGIN to make it search for shared libraries in the folder where the executable is. Then copy libstdc++.so.6 and other application dependencies (find them with ldd) into your application folder and distribute that folder. See man ld.so, section about $ORIGIN.

Upvotes: 1

Related Questions