Re: Possible ld-so bug.

Thomas Wouters (thomas@xs4all.nl)
Tue, 16 Feb 1999 00:47:16 +0100


On Mon, Feb 15, 1999 at 06:15:01PM -0500, Mattthew D. Pitts wrote:

> > 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.
>
> gcc -V 2.7.2 should cause the newer gcc/egcs compilers to "act" like gcc
> 2.7.2

Only if you have that version of gcc still installed on your PC. You'll
likely need the appropriate -b or even -B command line option, though.

centurion:~ > ls /usr/lib/gcc-lib/
i386-redhat-linux i686-pc-linux-gnu

centurion:~ > ls /usr/lib/gcc-lib/i386-redhat-linux/
2.7.2.3 egcs-2.90.27 egcs-2.90.29

centurion:~ > ls /usr/lib/gcc-lib/i686-pc-linux-gnu/
pgcc-2.91.57 pgcc-2.91.60

my 'gcc' binary defaults to 2.7.2.3, but if i want to invoke, say,
pgcc-2.91.60, i'd have to use 'gcc -Vpgcc-2.91.60 -bi686-pc-linux-gnu'.

> > 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.
>
> ./configure <host> <target> <build>

Configure checks enviroment though. You can do any of these:

(bash/sh, possibly other sh-alikes)

> CC="gcc -V2.7.2.3 -bi386-redhat-linux" ./configure [your options]

or

> export CC="/gnusr/local/bin/gcc -V2.8.1 -B/gnusr/local/libble \
-bi486-rms-lignux -O42 -fno-inline" [*]
> ./configure [your options]

(csh/tcsh-alikes)

> env CC="gcc -V2.7.2.3 -bi386-redhat-linux" ./configure [your options]

or

> setenv CC "/gnusr/local/bin/gcc -V2.8.1 -B/gnusr/local/libble \
-bi486-rms-lignux -O42 -fno-inline" [*]
>./configure [your options]

You can also set the 'CFLAGS' env variable for the options, i can imagine
that is considered slightly 'cleaner'.

Regards,
Thomas.

[*]: Yes, your system would have to be really sick to have such a setup...
but it would be amusing trying to find out which utilities are able to
cope with it and which aren't. :)

-
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/