Gcc compilation “cannot compute suffix of object files: cannot compile”

后端 未结 3 1182
一整个雨季
一整个雨季 2021-01-31 18:02

I\'m actually reading the LFS book (version 7.1) and I\'m blocked at page 53. Trying to compile gcc, I tried the following command:

./configure --target=$LFS_TGT         


        
3条回答
  •  清歌不尽
    2021-01-31 18:16

    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 look for the last error line.

    Quoting GCC FAQ: http://gcc.gnu.org/wiki/FAQ#configure_suffix

    Like any of the GNU projects, GCC is using the GNU autotools to commonly configure the compilation for the specifics of the build system. The configure script thereby uses small test programs - usually called conftest.c - to test if certain functions and/or features are available. If the compilation of such a test program fails, you'll see an error message like:

     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[2]: *** [configure-stage1-target-libgcc] Error
     1 make[2]: Leaving directory `/home/manu/gcc/gcc'
    

    This error message is quite misleading and frequently the problem has nothing to do with the message. You have to check the file 'config.log' in the directory where the error occurred. In the example above, you would have to check the 'config.log' file in the directory '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc'. There might be several test programs that failed during the configuration, but some of these failures are non-critical. Check for the last error entry in the file.

    Common causes for this error message are:

    • Required libraries for the GCC build are missing, specifically MPFR, GMP and MPC. If installed as shared libraries they must be in the runtime linker's search path so they can be found. Please, follow the instructions in the answer to Why does my ./configure and make fail?

    • The compiler crashed. For example, if there is an error such as 'conftest.c: internal compiler error:', this indicates a bug in the compiler. If you are using an unmodified version of GCC, please follow the procedure to report the bug.

提交回复
热议问题