ld can't find stdc++ right after the re-adjustment phase (section 6.10)

Angel Tsankov fn42551 at fmi.uni-sofia.bg
Sat Feb 7 13:34:17 PST 2009

Frist of all, I'd like to note that I've been following LFS 6.4 not very
strictly but close enough to think that the problem I've encountered might
concern LFS 6.4.

Now to the point. I'm building a LFS system with binutils version 2.18 and
gcc version 4.3.3 (glibc's version is 2.9-20090202, the kernel's version is
2.6.28; other packages' versions may also be different from those in LFS
and I've just found out that applying the
'/\*startfile_prefix_spec:/{n;s at .*@/usr/lib/ @}' sed script to
/tools/lib/gcc/i686-pc-linux-gnu/4.2.4/specs (as per the instruction in the
re-adjustment phase, section 6.10) prevents ld from finding the stdc++
library (which is located in "/tools/lib").  As a result, C++ programs fail
to link when I try to compile them with g++.  In contrast, they do link when
I compile them with gcc.  However, GMP checks for a C++ compiler by trying
compile a simple C++ program with g++ rather than with gcc and therefore
to configure.

I also found that "reverting" the changes from the above-mentioned sed
script or substituting "/usr/lib/ /tools/lib/" instead of just "/usr/lib/ "
both help.  However, none of these steps is in the LFS book and I wonder if
I have gone wrong somewhere.  Also, installing binutils (after making the
re-adjustments) does not help.

And, by the way, I had exactly the same problem with bniutils 2.16, gcc
4.2.4, glibc 2.3.6, and the same kernel version.

Angel Tsankov

More information about the lfs-support mailing list