Changing from g++ 2.95.3 to g++ 3.x

Stuart Brooks
Fri May 12 07:34:00 GMT 2006


I have a large number of systems running Netbsd 1.6.1 which uses gcc
2.95.3 as its native compiler. Inherent bugs with exception handling in
2.95 have forced me to look at recompiling our code base using a later
version (3.3.3 preferrably).

The code base consists of multiple executables, and I have successfully
compiled them all using gcc 3.3.3. When these executables are installed
onto an old system (along with the 3.3.3 libstdc++ and libgcc_s shared
libs) most of them run fine. I can run qt applications if I provide an
updated set of qt shared libs built with 3.3.3.

However some applications segmentation fault almost immediately. The
native gdb (5.0) refuses to loads the core files and the latest gdb
(6.3) seems to run out of memory after failing to load. I have attached
a printout if anyone is interested...

My guess is that I am linking in some libraries which have C++
interfaces and which were compiled with the old compiler. The following
snippet found using google bears that out:

>>> from
Switching to gcc 3.3:
Recompile all your C++ and Objective-C++ code, including all libraries
and frameworks that export a C++ interface. The application binary
interface (ABI) for C++ programs changed between GCC 2 and GCC 3.1, and
again between GCC 3.1 and GCC 3.3. The changes between GCC 2 and GCC 3.1
were comprehensive, including changes to name mangling, exception
handling, and class layout and alignment. The changes between 3.1 and
3.3 are much smaller, but are still large enough to prevent a mixed C++
program from operating correctly. Do not link C++ modules compiled with
one of these compilers against modules compiled with any of the other
two compilers. Even if the modules appear to link correctly, C++ ABI
differences may still cause problems that will not manifest themselves
until run time.

So my questions are (if anyone has got this far:) ...

 1. Is it possible to run executables compiled with a later compiler on
a system which had all its base libraries built with an earlier native

 2. Will libraries which export only a C interface be fine - because it
is not really practical for me to redistribute all the X libraries?

 3. Would it be a solution for me to isolate all shared libraries which
export a C++ interface and make sure they're updated?

Any help or ideas would be much appreciated. I hope this is the right
place to post for this - if not please let me know where would be more


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gdb_dump.txt
URL: <>

More information about the Gcc-help mailing list