LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Compiled GCC, but the result "cannot find -lgcc_s" (https://www.linuxquestions.org/questions/linux-software-2/compiled-gcc-but-the-result-cannot-find-lgcc_s-846097/)

AlucardZero 11-23-2010 03:30 PM

Compiled GCC, but the result "cannot find -lgcc_s"
 
Hi,

I want to use GCC 4.1.2 on a SLES 11.0 x86_64 system. SLES 11 comes with GCC 4.3, so I compiled 4.1.2 and `make install`'d myself. When trying to use it, I get:

Code:

# /usr/local/bin/gcc-4.1 hello.c 
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

hello.c is simply:
Code:

#include <stdio.h>
int main () {
  printf("hello world\n");
}

lgcc_s is libgcc_s.so.1 which is found in both /usr/local/lib/gcc/x86_64-suse-linux/lib64 and /usr/local/lib/gcc/x86_64-suse-linux/lib.

`/usr/local/bin/gcc-4.1 -static hello.c` works.
`/usr/local/bin/gcc-4.1 -L/usr/local/lib/gcc/x86_64-suse-linux/lib64 hello.c` works.
`/usr/bin/gcc-4.3 hello.c` works.

I created /etc/ld.so.conf.d/gcc-412.conf and added "/usr/local/lib/gcc/x86_64-suse-linux/lib64" and "/usr/local/lib/gcc/x86_64-suse-linux/lib" to it. I ran `ldconfig -v` and it does find them:
Code:

/usr/local/lib/gcc/x86_64-suse-linux/lib64:
        libgcc_s.so.1 -> libgcc_s.so.1
/usr/local/lib/gcc/x86_64-suse-linux/lib:
        libgcc_s.so.1 -> libgcc_s.so.1

However, I still get "cannot find -lgcc_s."

I did run the gcc test suites and there were only 12 unexpected failures or successes out of 55k, which the install page says is to be expected.

I ./configured gcc with
Quote:

Target: x86_64-suse-linux
Configured with: ../gcc-4.1.2/configure --enable-languages=c,c++ --enable-ssp --disable-libssp --disable-libgcj --disable-libmudflap --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.1 --enable-linux-futex --without-system-libunwind --build=x86_64-suse-linux --host=x86_64-suse-linux
-- basically, I took SLES' gcc-4.3 ./configure line and removed the prefix & path directives and changed the program suffix. Considering I don't know the use of half those options I'm trying again taking as many defaults as possible.

But I don't know what I am missing. How do I get it so that I don't have to use -L or -static to use my gcc-4.1?

knudfl 11-23-2010 04:59 PM

Quote:

I ./configured gcc with
Looks suspicious : It's "two dots" when you have a build directory
outside the gcc-4.1.2/ source : $ ../gcc-4.1.2/configure -- -- .
I.e. gcc cannot be build without that external build folder.
Except that your "configure" line / options look strange, I don't think,
you can build 4.1.x using gcc-4.3 ?

Build method to be used : LFS, Linux from scratch, book 6.3.


But fortunately, it's not necessary to build it.
Packages from Suse 11.1 can be used : The "compat gcc41" ...
http://download.opensuse.org/distrib...s/suse/x86_64/
Required : cpp41 gcc41 libstdc++41-devel gcc41-c++ ( All -x86_64 ).
..

AlucardZero 11-23-2010 05:43 PM

Quote:

Looks suspicious : It's "two dots"
Yes, sorry, I actually was in /tmp/gccbuild and did ../gcc-4.1.2/configure.
Quote:

I don't think, you can build 4.1.x using gcc-4.3 ?
.. really?
Quote:

Packages from Suse 11.1 can be used
Is mixing OpenSUSE and SLES smart? I suppose I can try it tomorrow.. I'll check for file conflicts before installing.

knudfl 11-24-2010 03:11 AM

Quote:

Is mixing OpenSUSE and SLES smart? I suppose I can try it tomorrow..
I'll check for file conflicts before installing.
I did # rpm -Uvh cpp41 , etc. etc. on a SLED 11 - 32bit yesterday.
And gcc33 -v comes with the "usual reply".

How could there be any conflicts ? These compat compilers,
gcc33, gcc41 etc. are all used at the same time in Suse 11.1,
11.2, 11.3. (But I haven't tested gcc41 on SLED 11 before.)

I have used the Suse gcc33, gcc41 in Fedora 10-13, Mandriva, PCLinuxOS.
They always work.
..


All times are GMT -5. The time now is 12:47 AM.