无法升级gcc g++

我把几个升级源都加了,就是升级不到 gcc 5.0 g++ 5.0. 我又下了 gcc 的源代码,可惜编译通不过。

linux-337q:/home/suse/gcc-5.1.0 # ./configure
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.
linux-337q:/home/suse/gcc-5.1.0 # make
make: *** 没有指明目标并且找不到 makefile。 停止。

首先,openSUSE 的 OBS 里已经有 gcc5 了,三天前编译的。https://software.opensuse.org/package/gcc5。而且不是不明的 home 源里的,是 devel:gcc 源里的。

作为一个有操守的主流发行版,openSUSE 更进新包的速度还是很快的。(虽然 editors 源到现在还没有升级 emacs 24.5 …)

其次,编译要是都那么简便顺利就好了… 都不要人打包了。这样直接编译安装后患无穷的。假如说 OBS 里没有 gcc5 的包,最好的办法是下载 gcc4 的 spec 文件,然后根据它用 rpmbuild 把 gcc5 编译成 rpm 包。这样成功率高,安装 rpm 也比较环保。

同样建议尽量用包管理方式安装,就算找不到合适的源也尽量尝试打包安装,干净很多。

顺便一提,你给出的错误信息里面已经说得很清楚了:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.