Using gcc with libraries built with Sun's compiler

Alexandre Oliva aoliva@redhat.com
Tue Jun 5 14:38:00 GMT 2001


On Jun  5, 2001, John Adomaitis <jadomaitis@us.gaussinterprise.com> wrote:

> The problem we are having is when we compile and link with a Merant
> odbc library with gcc on Sun it generates a segmentation fault when
> we invoke the executable.

I'm afraid you're in trouble.  In general, you can't link into the
same program C++ libraries created by different compilers.  The
problem is that the C++ standard libraries of both compilers will
attempt to initialize their notions of cin, cout and cerr, but since
the compilers use different representations, one of them will crash.

Try linking statically with libstdc++.a, and avoid at all costs
bringing in cin, cout and cerr from it.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-help mailing list