gccgcc9

Error compiling GCC 9.2: libgotool.a: No such file


On a fresh install of Fedora 30 onto a VM (in the below yum gets gcc 9.1, and trying to use that to build gcc 9.2):

sudo yum install make cmake gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel zlib-devel libgo libgo-devel go g++ 
wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
tar xf gcc-9.2.0.tar.xz
cd gcc-9.2.0
./configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
make

gives:

make[4]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[3]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Entering directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/gccgo -B/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include   -g -O2 -I ../x86_64-pc-linux-gnu/libgo -static-libstdc++ -static-libgcc  -L ../x86_64-pc-linux-gnu/libgo -L ../x86_64-pc-linux-gnu/libgo/.libs -o go ../.././gotools/../libgo/go/cmd/go/alldocs.go ../.././gotools/../libgo/go/cmd/go/go11.go ../.././gotools/../libgo/go/cmd/go/main.go ../x86_64-pc-linux-gnu/libgo/libgotool.a  
gccgo: error: ../x86_64-pc-linux-gnu/libgo/libgotool.a: No such file or directory
make[2]: *** [Makefile:821: go] Error 1
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
make[1]: *** [Makefile:14649: all-gotools] Error 2
make[1]: Leaving directory '/home/mmalak/gcc-9.2.0'
make: *** [Makefile:997: all] Error 2

Yet libgotool.a exists in /home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo/libgotool.a


Solution

  • I don't know if this is the reason but it is not recommended to configure and build gcc in the same directory of source code. Try:

    cd ../
    mkdir stage1-build && cd stage1-build
    ../gcc-9.2.0/configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
    make