编译 GCC 9.2 时出错:libgotool.a:没有这样的文件

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

在虚拟机上全新安装 Fedora 30(在下面的 yum 中获取 gcc 9.1,并尝试使用它来构建 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

给出:

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

然而 libgotool.a 存在于 /home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo/libgotool.a

不知道是不是这个原因,不建议在源码目录下配置编译gcc。尝试:

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