cannot find -lgcc_s

I am trying to build llvm-gcc4.2-2.6.

My configure options are

$ /local/tools/lin32/llvm-gcc4.2-2.6/bin/llvm-gcc -v
Using built-in specs.
Target: i686-linux
Configured with: ../llvm-gcc4.2-2.6.source/configure --prefix=/local/tools/lin32/llvm-gcc4.2-2.6 --disable-nls --enable-shared --enable-threads=posix --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --target=i686-linux --with-as=/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-as --with-ld=/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-ld --enable-llvm=/local/tools/src/llvm-gcc4.2-2.6/build-i686-linux-llvm/objdirllvm --program-prefix=llvm- --enable-libffi=no --enable-__cxa_atexit --with-sysroot=/local/tools/lin32/glibc-2.2.5-44 --disable-tls --enable-clocale=gnu
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5649) (LLVM build)

I do a make bootstrap and make install after configure.

But when I try to run this gcc I get

$ /local/tools/lin32/llvm-gcc4.2-2.6/bin/i686-linux-llvm-gcc a.c
/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

libgcc_s.so* is presnet under /local/tools/lin32/llvm-gcc4.2-2.6/lib

Any ideas what is going wrong here? print-search-dirs gives the following which obviuosly does not include libgcc_s.so* path

$ /local/tools/lin32/llvm-gcc4.2-2.6/bin/i686-linux-llvm-gcc -print-search-dirs
install: /local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/
programs: =/local/tools/lin32/llvm-gcc4.2-2.6/libexec/gcc/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/libexec/gcc/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/libexec/gcc/i686-linux/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/../../../../i686-linux/bin/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/../../../../i686-linux/bin/
libraries: =/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/../../../../i686-linux/lib/i686-linux/4.2.1/:/local/tools/lin32/llvm-gcc4.2-2.6/lib/gcc/i686-linux/4.2.1/../../../../i686-linux/lib/:/local/tools/lin32/glibc-2.2.5-44/local/tools/lin32/llvm-gcc4.2-2.6/lib/i686-linux/4.2.1/:/local/tools/lin32/glibc-2.2.5-44/local/tools/lin32/llvm-gcc4.2-2.6/lib/:/local/tools/lin32/glibc-2.2.5-44/lib/i686-linux/4.2.1/:/local/tools/lin32/glibc-2.2.5-44/lib/:/local/tools/lin32/glibc-2.2.5-44/usr/lib/i686-linux/4.2.1/:/local/tools/lin32/glibc-2.2.5-44/usr/lib/

If I try to build it without --with-sysroot everything works fine. But not with --with-sysroot. Any suggestions?

Hi John,

I am trying to build llvm-gcc4.2-2.6.

My configure options are

$ /local/tools/lin32/llvm-gcc4.2-2.6/bin/llvm-gcc -v
Using built-in specs.
Target: i686-linux
Configured with: ../llvm-gcc4.2-2.6.source/configure --prefix=/local/tools/lin32/llvm-gcc4.2-2.6 --disable-nls --enable-shared --enable-threads=posix --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --target=i686-linux --with-as=/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-as --with-ld=/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-ld --enable-llvm=/local/tools/src/llvm-gcc4.2-2.6/build-i686-linux-llvm/objdirllvm --program-prefix=llvm- --enable-libffi=no --enable-__cxa_atexit --with-sysroot=/local/tools/lin32/glibc-2.2.5-44 --disable-tls --enable-clocale=gnu
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5649) (LLVM build)

I do a make bootstrap and make install after configure.

But when I try to run this gcc I get

$ /local/tools/lin32/llvm-gcc4.2-2.6/bin/i686-linux-llvm-gcc a.c
/local/tools/lin32/binutils-2.17.50.0.15/bin/i686-linux-ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

does the same thing happen if you configure, build and install mainline gcc 4.2
rather than llvm-gcc?

Ciao,

Duncan.

Thanks for the reply Duncan. --with-sysroot is messing up the path. gnu gcc-4.2.1 works fine with --with-sysroot. So I guess this is problem is specific to llvm-gcc.