gcc local installation (linux) not finding runtime libs
Lionel B
lionelbuk@yahoo.co.uk
Fri May 4 11:38:00 GMT 2007
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?
--
Lionel B
More information about the Gcc-help
mailing list