Question

I recently compiled a binary on my Ubuntu Server and distributed it. This is the error users are experiencing:

Failed (/lib32/libc.so.6: version `GLIBC_2.17' not found

Any ideas on how to fix it? I used another Linux distro (CentOS 6) before and it worked fine (for me and other users).

How can I fix it?

Was it helpful?

Solution 2

If you want to use the newer library you have two options

  1. statically link libstdc++.
  2. distributing your version of the library with the binary and using RPATH while linking.

You can statically link with g++ using the -static-libgcc -static-libstdc++ -static this should pretty much statically link everything but will enlarge your binary.

Another option is using RPATH the -rpath linker option can be passed like so :

-Wl,-rpath,$PATH replacing $PATH with something like libs or maybe just . for same directory as binary this way the header of the generated ELF (executable) will know where to look for the shared libraries required and you can just redistribute the shared libraries with your binary.

otherwise you could just compile and link with the version supported on your target machines.

OTHER TIPS

The simplest solution is to build on the oldest system you want to support.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top