Skip to content
Advertisement

How do I find what libraries need to be installed on a client linux machine if I compile a binary with a newer version of gcc?

Say I have a C++ binary that was compiled with a version of gcc say 4.4.x, which is used on a client linux box.

If I want to upgrade my compiler to use a newer one, say 4.9.3 (because I want to use C++11):

What kind of things would need to be upgraded on the client box to run this new binary? (e.g. .so libraries) And how would one find this out?

Advertisement

Answer

What kind of things would need to be upgraded on the client box to run this new binary?

You will need to ship two shared libraries with your application: libgcc_s and libstdc++. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for more details.

You can ship these libraries in the same directory with your executables if you link using $ORIGIN. See https://stackoverflow.com/a/4742034/412080 for more details.

And how would one find this out?

Run ldd and readelf -d on your executables to see what libraries they need.

Advertisement