Linking agains libstdc++.so.5 on gcc > 3.4

Andrew Haley aph@redhat.com
Wed Sep 3 10:50:00 GMT 2008


luca regini wrote:
> I am currently using a shared library (whose source i don't have
> access to) that is linked against libstdc++.so.5. For reasons that i
> am not into explaining we must compile and link
> against this library on RedHat Linux EL 5 that comes with a gcc > 4
> and defaults its c++ runtime to version 6 ( libstdc++.so.6). This
> results in memory leaks because memory
> allocated on one runtime cannot be freed on the other. Is there a way
> to force linking on libstdc++.so.5? From an internet search it seems
> to me that the only way is to build gcc 3.3 on my development box.

This will work.

> If
> this is the answer then i would like to know how can the built gcc
> version be able to use libstdc++.so.5 since the default runtime is
> libstdc++.so.6.

The built gcc has its own copy of libstdc++.so.5.  This gets installed
when you install the compiler.

Andrew.



More information about the Gcc-help mailing list