Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

are gcc-3 binaries compatible with gcc-4

I have a static library that has been compiled with gcc 3.4.3 .I would like to use this in code that will now be compiled with gcc-4. I've read vaguely that gcc-3 and gcc-4 binaries are not compatible and that the library will need to be recompiled , but just want confirmation on this. Isn't there anyway a gcc-3 library can be used with gcc-4 ?

like image 971
Abhijith Avatar asked May 06 '11 15:05

Abhijith


People also ask

What is Libstdc?

What is libstdc++? The GNU Standard C++ Library v3 is an ongoing project to implement the ISO 14882 C++ Standard Library as described in clauses 20 through 33 and annex D (prior to the 2017 standard the library clauses started with 17).

What ABI does GCC use?

From GCC version 3 onwards the GNU C++ compiler uses an industry-standard C++ ABI, the Itanium C++ ABI.


1 Answers

Getting someone else in the organization, or at a vendor, to update their library to gcc 4 is not always an option, especially if they've abandoned it.

If C++: assuming that are able to link, at runtime you can blow up in C++ standard library template code that uses streams, as symbols generated by g++ 4 are resolved against definitions generated by g++ 3.

You might see this warning when linking:

/usr/bin/ld: warning: libstdc++.so.5, needed by (legacy static lib), may conflict with libstdc++.so.6

Here's an example you can get into: base class destructor ~basic_stringbuf() (actually a template) can be defined in your module compiled under g++ 3, which mistakenly gets called by the destructor ~basic_ostringstream() in libstdc++so.6, which is invoked by the g++ 4 compiled module. Ka-Boom.

I tried compat-libstdc++-33 but had no luck with that.

That said, I still link 32-bit gcc 3 era C libraries into my gcc 4.1.2 C++ programs.

like image 182
Erik Olson Avatar answered Sep 21 '22 06:09

Erik Olson