Reputation: 181
Consider the following: I have a c++ file. I use RHEL6 machine to compile my code. But i want my executable/binary to be able to run on RHEL4 as well. Now I have experienced the following 3 cases-
error while loading shared libraries: requires glibc 2.5 or later dynamic linker
The solution to this is given on gcc: Reduce libc required version. After the fix, I am able to run the binary on RHEL4.
If I compile (on RHEL6 with the same gcc version) with static libraries,
I am able to execute it on RHEL4 machine. No need of using -Wl,--hash-style=both
as in case 1.
If I compile my project(instead of single file) on RHEL6, then I get the following error when I run the binary on RHEL4 platform.
/lib64/libc.so.6: version `GLIBC_2.7' not found
My question is :
a) Why does no error comes in case of statically linking libraries.
b) What is the difference between the errors produced in case 1 and case 3.
Upvotes: 0
Views: 340
Reputation: 384
Upvotes: 0