Bug 18356

Summary: Undefined references with libX11.so and egcs++
Product: [Retired] Red Hat Linux Reporter: Need Real Name <minutsil>
Component: egcsAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-04 19:21:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2000-10-04 19:21:38 UTC
Under RH7.0, some of my old programs do not compile with the new gcc/g++
(2.96), so I installed compat-egcs and compat-egcs++ and dependencies. With
egcs++, however, I get some unresolved symbols in libX11.so (X4).

509) silviu:~/WORK/TOOLS> egcs++ -v
Reading specs from /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

508) silviu:~/WORK/TOOLS> make CC=egcs++ tango
(cd GYPSY; make libgypsy)
make[1]: Entering directory `/home/silviu/WORK.10.4/GYPSY'
ar r libgypsy.a foveate.o grid.o gypsy.o utils.o cblock.o cgrid.o \
grab.o indexx.o
mv libgypsy.a /home/silviu/WORK/lib
make[1]: Leaving directory `/home/silviu/WORK.10.4/GYPSY'
(cd PGM; make libpgm)
make[1]: Entering directory `/home/silviu/WORK.10.4/PGM'
ar r libpgm++.a pgm.o fov.o dct.o edge.o blob.o realfft.o clog.o ppm.o
mv libpgm++.a /home/silviu/WORK/lib
make[1]: Leaving directory `/home/silviu/WORK.10.4/PGM'
egcs++ -o tango -g -Wall -L/home/silviu/WORK/lib -L/usr/X11R6/lib -IPGM
-IGYPSY -I/usr/X11R6/include `imlib-config --cflags-gdk` tango.o swin.o
-lX11 -lgypsy -lpgm++    
/usr/X11R6/lib/libX11.so: undefined reference to `getpwuid_r.2'
/usr/X11R6/lib/libX11.so: undefined reference to `shmctl'
/usr/X11R6/lib/libX11.so: undefined reference to `getpwnam_r.2'
collect2: ld returned 1 exit status
make: *** [tango] Error 1


All is well if I compile this program with g++-2.96, but then, as I
mentioned above, there are other programs that do not compile with g++.

Comment 1 Jakub Jelinek 2000-10-05 05:38:26 UTC
First of all, I'd be interested in bugzilla reports about apps which
you are not able to build with gcc 2.96 (unless it is an obvious
error in the package, like lyx), best with all relevant details.
Second, if you're using egcs++, then you either have to make
sure -L/usr/lib is on the command line, or -L/usr/i386-glibc21-linux/lib/
is given before -L/usr/X11R6/lib, or compat-libs and compat-glibc
packages are not installed.
The issue is that egcs++ adds -L/usr/i386-glibc21-linux/lib internally
to search path, so that binaries built with it can be run on RH 6.x.
But if libc is picked from that directory (there is a RH 6.x glibc),
you need to make sure libX11 is picked from there as well, because you
cannot mix X11 libraries linked against glibc 2.1.9x with glibc 2.1.3.
Look at kde1 src.rpms in the distribution, they are also compiled
with egcs++ (because KDE1 does not follow C++ standards too closely)
and they make sure the libraries match.