Can primary glibc 2.1.x coexist with non-primary glibc 2.2.x WRT shared binaries?

Can primary glibc 2.1.x coexist with non-primary glibc 2.2.x WRT shared binaries?

Post by Ken Whale » Sun, 29 Apr 2001 07:11:10



I'd like to install and use a non-primary glibc 2.2.x on a system with glibc
2.1.x as the primary glibc (2.2.x and 2.1.x are incompatible).  All system
binaries are shared and expect glibc 2.1.x.  My goal is to build and run
shared binaries using the non-primary glibc 2.2.x on the same system as
well.
All the FAQs and HOWTOs that I've seen about using non-primary glibc2
assume that the primary glibc is glibc1.  This is pretty easy, since glibc1
used ld-linux.so.1, and glibc2 uses ld-linux.so.2, so there's no
collision between the dynamic linker/loaders.   But glibc 2.1.x and
glibc 2.2.x BOTH use "ld-linux.so.2".  I've worked around this by changing
the
link in mynon-primary glibc2.2.1 (installed in /usr/local/testglibc2.2.1)
from
"ld-linux.so.2" to "ld-linux.so.3", and binary-patched the 2.2.x libc.so.6
to refer to the ld-linux.so.3 (if I don't do this, the system uses
/lib/ld-linux.so.2, which points to ld-2.1.3.so, and the glibc 2.2.x
shared binary doesn't load).

My makefile for a simple hello world shared binary (using the non-primary
glibc 2.2.x) is as follows:

testglibc = /usr/local/testglibc2.2.1
gcc = gcc
.PHONY: all
all: hello
hello: hello.o
 $(gcc) -v -shared -fPIC -Wl,-t \
  -Wl,--dynamic-linker=$(testglibc)/lib/ld-2.2.1.so \
  -B$(testglibc)/lib/ \
  -Wl,-rpath=$(testglibc)/lib \

hello.o: hello.c

clean:
 rm -f  hello hello.o

The resulting binary compiles and links, and ldd shows all the right
libraries being referenced (all in /usr/local/testglibc2.2.1/lib),
but when run it seg faults.

Several people I've talked to about this say "yeah, I've done that"
but haven't offered any concrete instructions or makefiles, etc., on
how to do this.   Again, the glibc FAQ that I can see does NOT address
this scenario.  Any light that anyone can shed on the matter would be
most appreciated.

 
 
 

Can primary glibc 2.1.x coexist with non-primary glibc 2.2.x WRT shared binaries?

Post by John Reise » Sun, 29 Apr 2001 07:48:03


Quote:> The resulting binary compiles and links, and ldd shows all the right
> libraries being referenced (all in /usr/local/testglibc2.2.1/lib),
> but when run it seg faults.

What does ldd say about ld-linux?  For instance:
-----
$ ldd /bin/date
        libc.so.6 => /lib/libc.so.6 (0x4001a000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)   ### this line
-----
is the correct ld-linux being used for 'hello'?

What does "strace ./hello" report?

What happens when running 'hello' under gdb?
        gdb hello
        run
                ### assume SIGSEGV here
        where
        bt
        x/i $pc
        info reg
        x/12i $pc-0x18

--


 
 
 

Can primary glibc 2.1.x coexist with non-primary glibc 2.2.x WRT shared binaries?

Post by My Name Her » Sun, 29 Apr 2001 11:12:43


Duh.  Red-herring time.  My problem was not in the specifying of the
non-primary glibc, but my incorrect arguments to gcc.  -shared and -fPIC
are for producing a shared library, not an executable that links with shared
libraries.

Thanks for the series of questions, they led me back to thinking about
the basics.

For the record, here's what I did to get this to work:

Built glibc 2.2.1 with:

% ../src/configure --prefix=/usr/local/testglibc2.2.1 --enable-add-ons
% make
% make install

And here's the working makefile for the non-primary shared hello,
I believe (except for the -g and -O0) the arguments to gcc are
the sufficient ones (they're certainly necessary) to get this to
work:

testglibc = /usr/local/testglibc2.2.1
gcc = gcc

.PHONY: all
all: hello

hello: hello.o
 $(gcc) -Wl,--dynamic-linker=$(testglibc)/lib/ld-linux.so.2 \
  -B$(testglibc)/lib/ \
  -Wl,-rpath=$(testglibc)/lib \

hello.o: hello.c

clean:
 rm -f hello hello.o

 
 
 

1. glibc 2.1 and glibc 2.2

Could some Linux guru out there tell me whether it is possible to have both
glibc 2.1 and 2.2 co-exist on the same system? FYI, my system is a Redhat
7.1 with all the latest patches/updates applied. The reason for asking is
that I have an application that requires the ver 2.1 glibc while I have the
2.2 glibc installed. The application is Corel WordPerfect Office 2000.

--
Regards,
Ridzwan Abdullah

2. Accepting redirects?

3. Upgrading from glibc 2.1 to glibc 2.2

4. Linux on 2. partition?

5. Can ftp in but not out?

6. glibc 2.0 or glibc 2.1

7. is the Cogent E/Master ethernet card supported?

8. Redhat 7.0: glibc-common = 2.2 is needed by glibc-2.2-12

9. How to upgrade glibc 2.1 to 2.2

10. Upgrading from glibc 2.1 to 2.2?

11. Trouble upgrading from glibc-2.1.2 to glibc-2.2.2 (rpm failed dependencies)

12. glibc 2.1/glibc 1.99