Re: Possible ld-so bug.

Vladimir Dergachev (vdergach@sas.upenn.edu)
Mon, 15 Feb 1999 02:03:58 -0500 (EST)


I had similar problems. Turns out you have to be careful what you compile
with.
I.e. : suppose you had a gcc-2.7.2 installation, with libraries in
/usr/lib. You install egcs compiler in /usr/local/lib. Now you got two
sets of libraries in /usr/lib and /usr/local/lib.
And you have two sets of gcc compilers in /usr/bin and /usr/local/bin.

Now I was lucky - my root user had (by accident) /usr/local/bin earlier in
the path than /usr/bin/. Normal users didn't and I had a weird problem
when compile failed or succeded based on what user run it.

The problem is that ./configure scripts look in /usr/bin for gcc compiler
by default. So if your default compiler is egcs, they will try to use
libraries belonging to the old compiler with the new compiler. The result
is the program that segfaults.

Note that simply removing /usr/bin/gcc doesn't help. In that case
./configure (in all programs) says that it doesn't know what host it is
running on. You really have to make a link in /usr/bin/ to the actual gcc
running.

If you really want to keep several compilers on your system my advice is
to name them like gcc-2.7.2 , gcc-2.8.1, egcs and make /usr/bin/gcc a link
to them. Same stands for g++.

Vladimir Dergachev
PS I also forgot - the order in ld.so.conf also matters - this will decide
on the choice of libraries.
PSS The symptom of this is when during the build you get ld warning's
about two similar libraries

On Sun, 14 Feb 1999, Richard B. Johnson wrote:

>
> Kernel gurus:
>
> Warning. If you already have glibc-2.0.6 installed on your
> machine, but you decide to build and install it with a later 'C'
> compiler, perhaps to improve performance, you just might not
> have a workable system after you do this. It seems that ld.so
> (or something else) gets confused when you install a new version
> of the libraries that don't have a new version number.
>
> The fact that `make` and `make test` do not produce any errors
> means nothing! `make install` can (read will) destroy your
> system. I don't know if the bug is in ld.so or in glib-c, but
> with a new 'C' compiler, the generated code will have different
> offsets which means that new and old libraries can't be mixed.
> Somebody (not me) mixes them, the result being a disaster.
>
> I tried to send information to bugs@gnu.org, but they apparently
> have shut me off:
>
> setsockopt(3, IPPROTO_IP1, [16], 4) = 0
> connect(3, {sin_family=AF_INET, sin_port=htons(25),
> sin_addr=inet_addr("158.121.106.20")}, 16) = -1 ECONNREFUSED (Connection refused)
>
> There are 24 hours of this at 10 minute intervals.
>
> The symptoms are that every non-static executable seg-faults.
> This is not nice. I had to install everything from scratch and lost
> a lot of work at home because I didn't have another computer that
> I could use to re-mount my destroyed '/' fs and copy my stuff off.
>
> Cheers,
> Dick Johnson
> ***** FILE SYSTEM WAS MODIFIED *****
> Penguin : Linux version 2.2.1 on an i686 machine (399.77 BogoMips).
> Warning : It's hard to remain at the trailing edge of technology.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/