This issue is concerned by dyanmic link library path issue when the test programs attempt to link against libmpc/libmpfr/libgmp.
Append below environment variable for allowing ld link against the correct so file:
Then attempt build gcc again.
"*Building GCC is not trivial, however is not difficult in case you follow the instructions carefully. Many people rush into attempting to make it without reading the installation docs rightly and create one or more of these common mistakes:
1) do not run ./configure from gcc src dir (this is not supported) => you require to run configure from outside the gcc source directory
2) Note: if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries must be in the dynamic linker's path (LD_LIBRARY_PATH), both when building gcc and when using the installed compiler.*"
Simple example (without dynamic link to GMP/MPFR/MPC):
tar xzf gcc-4.8.0.tar.gz
This error message can arise from a number of different reasons. The best way to figure out which one is to check the logfile '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc/config.log' in the example below. Or in the original posters case '/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc' and watch for the last error line.
Like any of the GNU projects, GCC is employing the GNU autotools to usually configure the compilation for the specifics of the build system. The configure script thereby uses small test programs - generally named conftest.c - to test in case given functions and/or features are available. In case the compilation of such a test program fails, you'll see an error message :
checking for suffix of object files... configure: error: in
`/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc': configure: error:
cannot compute suffix of object files: cannot compile See `config.log'
for more details. make: *** [configure-stage1-target-libgcc] Error
1 make: Leaving directory `/home/manu/gcc/gcc'
This error message is completely misleading and repeatedly the problem has nothing to do with the message. You have to inspect the file 'config.log' in the directory where the error happened. In the example above, you would have to inspect the 'config.log' file in the directory '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc'. There might be various test programs that failed at the time of the configuration, however some of these failures are non-critical. Inspect for the last error entry in the file.
Common reasons for this error message are:
Necessary libraries for the GCC build are missing, particularly MPFR, GMP and MPC. In case installed as shared libraries they should be in the runtime linker's search path so they can be put in. Please, pursue the instructions in the answer to Why does my ./configure and make fail?
The compiler crashed. Such as in case there is an error such as 'conftest.c: internal compiler error:', this indicates a bug in the compiler. In case you are employing an unmodified version of GCC, please pursue the action to report the bug.