Re: gcc local installation (linux) not finding runtime libs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 04 May 2007 11:37:23 +0000, Lionel B wrote:

> Hi,
> 
> I am trying to maintain several local gcc installations, built from
> sorce, on my (linux x86_64) system. I find a problem with my gcc-4.1.2
> build/installation.
> 
> My setup is as follows: I have a local base directory, <gcc-base>, say
> in which I unpacked the gcc source to a subdir src. I also created, in
> <gcc- base>, subdirs obj and install:
> 
>   <gcc-base>/src     <--- source tree
>   <gcc-base>/obj     <--- for building
>   <gcc-base>/install <--- for actuall installation
> 
> I also have binutils (2.17) in a similar setup, with the actual
> installation in a folder <binutils-base>/install.
> 
> I want these binutils (as, ld, etc.) - rather than the system versions
> in /usr/bin - to be used both for the gcc build and also to be used by
> gcc once built. To configure/build, I did as follows:
> 
> cd to <gcc-base>/obj
> 
> then configure as:
> 
>   <gcc-base>/src/configure --prefix=<gcc-base>/install --enable-
> languages=c,c++ --with-gnu-as --with-as=<binutils-base>/install/bin/as
> -- with-gnu-ld --with-ld=<binutils-base>/install/bin/ld
> --enable-version- specific-runtime-libs
> --with-build-time-tools=<binutils-base>/install/bin
> 
> I used --enable-version-specific-runtime-libs as there will be different
> runtime libs on my system. Then:
> 
>   make
>   make install
> 
> All appeared to go smoothly. However, the new gcc does not appear to
> find the appropriate runtime libs. Test prog (C++):
> 
>   // test.cpp
> 
>   #include<iostream>
> 
>   int main()
>   {
>       std::cout << "Hallo world" << std::endl;
>   }
> 
> I now compile:
> 
>   <gcc-base>/install/bin/g++ -c test.cpp
> 
> compiles ok. Linking:
> 
>   <gcc-base>/install/bin/g++ test.o -o test
>   <binutils-base>/install/bin/ld: cannot find -lgcc_s collect2: ld
>   returned 1 exit status
> 
> I can link ok statically (huge binary!), or by specifying the runtime
> lib search path explicitly:
> 
>   <gcc-base>/install/bin/g++ test.o -L<gcc-base>/install/lib/gcc/x86_64-
> unknown-linux-gnu/lib64 -o test
> 
> Curiously, I followed the exact same procedure with gcc-4.1.1 and don't
> get this problem... what am I doing wrong?

As a follow-up to this, if I perform the linking step with the -v flag, 
then I see that the library paths searched are:

  -L<gcc-base>/install/lib/gcc/x86_64-unknown-linux-gnu/4.1.2
  -L<gcc-base>/install/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../..
  -L/lib/../lib64
  -L/usr/lib/../lib64

and indeed, libgcc_s.so is not on any of those paths... it should be 
picked up from:

  <gcc-base>/install/lib/gcc/x86_64-unknown-linux-gnu/lib64

Any ideas?

-- 
Lionel B


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux