Gcc libraries

Ajay Bansal Ajay_Bansal@infosys.com
Tue Feb 18 17:26:00 GMT 2003


Thanks everybody for inputs. Now I'll return to my original question. 

Linking by gcc is done in such a way that library names are stored with
their version number intact. What I mean is that say I build a program
test.cpp with gcc.

On doing ldd, I get the following output,

ldd ./a.out
        libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 (0x40014000)
        libm.so.6 => /lib/i686/libm.so.6 (0x400dc000)
        libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x400fe000)
        libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)


This means that the end machine should have libstdc++.so.5. Generally my
experience with other machines is such that one links against the
un-versioned library name:
 
    libstdc++.so
 
That name will be a link to a specific version of the library:
 
    libstdc++.so -> libstdc++.so.4 or libstdc++.so -> libstdc++.so.5

But that is not the case on Linux. 

What I wonder is that how shared libraries are versioned on Linux?

thanks in Advance
Ajay




More information about the Gcc-help mailing list