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

后端 未结 3 1187
一整个雨季
一整个雨季 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:17

    "Building GCC is not trivial, but is not difficult if you follow the instructions carefully. Many people rush into trying to build it without reading the installation docs properly and make one or more of these common mistakes:

    1. do not run ./configure from gcc src dir (this is not supported) => you need 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
    cd gcc-4.8.0
    ./contrib/download_prerequisites
    cd ..
    mkdir objdir
    cd objdir
    $PWD/../gcc-4.8.0/configure --prefix=/opt/gcc-4.8.0 
    make
    make install
    

    Sources: Advogato Doc - GNU Doc

提交回复
热议问题