Trouble building gcc on 64bit RHEL5

gcc

G'day,

on a 64bit RHEL5 box we need to install our 32bit application. For some reasons we need to use gcc 4.0.3 for this, so I tried to install that version on the target machine first, like I did a thousand times on 32bit target platforms.

This time, however, I am experiencing problems. I have bootstrapped and instaled gcc 4.0.3 into a path, let's say /foo. Like always I set the LD_LIBRARY_PATH to point into the directory containing shared libraries:

 $ echo $LD_LIBRARY_PATH
/foo/lib:/foo/lib/gcc/x86_64-unknown-linux-gnu/lib64:/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3:/lib64

There really are the necessary libraries in these directories:

 $ ls /foo/lib/gcc/x86_64-unknown-linux-gnu/lib64
libgcc_s.so  libgcc_s.so.1
 $ ls /foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3
32           crtendS.o      libgcov.a        libmudflap.so.0.0.0  libmudflapth.so.0.0.0  libstdc++.so.6.0.7
crtbegin.o   include        libmudflap.a     libmudflapth.a       libstdc++.a            libsupc++.a
crtbeginS.o  install-tools  libmudflap.la    libmudflapth.la      libstdc++.la           libsupc++.la
crtbeginT.o  libgcc.a       libmudflap.so    libmudflapth.so      libstdc++.so
crtend.o     libgcc_eh.a    libmudflap.so.0  libmudflapth.so.0    libstdc++.so.6

However, if I try to create a simple program, ld can't find libgcc_s:

 $ gcc-4.0 t.cc
/foo/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

Why doesn't it find the libgcc_s.so library?

Any help appreciated!

Stefan

Best Answer

It seems your folder /foo/lib/gcc/x86_64-unknown-linux-gnu/lib64 where libgcc_s.so is not included. For the sake of experiment do this:

gcc-4.0 -v t.cc -L/foo/lib/gcc/x86_64-unknown-linux-gnu/lib64

Related Topic