This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

G++ bug: Conflict between glibc and libstdc++



I think I have found the problem with SIGSEGV's I've been having using
g++ on a Slackware 7.0, i686, running linux 2.2.14.  The last post I made
concerning it is at:

           http://gcc.gnu.org/ml/gcc/2000-01/msg00833.html

In short, the following trivial test code:


                 extern "C" {
                 #include <stdio.h>
                 }

                 #include <complex>

                 int main()
                 {
                   double_complex a(0.0,0.0);

                   printf("a=%g,%g\n",real(a),imag(a));

                   return 0;
                 }


When compiled with g++ (2.95.2 19991024 or one of the recent snapshots)
as

> g++ test.cc
> a.out

SIGSEGV's.  If I use egcs-1.1.2 it works properly.  It also works
properly if I link statically or run on the executable on another box
(an i586 on which I manually installed glibc-2.1.2 and gcc-2.95.2).

I was pretty sure that this was a library confilict between the
slackware install and the libraries compiled with gcc-2.95.2, but now
I'm not so sure.  First, I reinstalled glibc (2.1.2pre3), compiled
using gcc-2.95.2, as the primary libc (i.e., I got rid of slackware's
version altogether); the code still fails.

Then today I tried the following:

> g++ -o test.cc
> gcc -v test.o -lc -lstdc++

This works.

> gcc -v test.o -lstdc++ -lc

This SIGSEGV's and is what g++ does by default on my system (it is
also what egcs does).

1.  Should the link order matter in this case?  If so, then it would
    seem that g++'s default is wrong?  If not, then is there a bug in
    glibc or libstdc++?  Since egcs-g++ links in the same order, it
    sounds like it is the latter.

2.  Is there a simple way in which to globally change the link order
    without recompiling?
    
3.  Is this problem simply one associated with the kind of mixed C/C++
    code I have or is it more general?  I suspect that it is the
    latter since I'm getting a very large number of execution
    failures in the C++ testsuite.

4.  Why does linking statically remove the problem?  The same
    libraries get linked in the same default order.

David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]