Problem background
Linux needs to be executed when gcc is installed ./contrib/download_prerequisites
. It will download several dependencies: mpfr , mpc , gmp, etc.
The original download link is slow:
[luban@k8s-deploy-6ph3mb-1616471870889-7d64d9dc66-w579j gcc-4.9.4]$ ./contrib/download_prerequisites
--2021-03-24 17:32:54-- ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
=> 'mpfr-2.4.2.tar.bz2'
Resolving gcc.gnu.org (gcc.gnu.org)... 8.43.85.97, 2620:52:3:1:0:246e:9693:128c
Connecting to gcc.gnu.org (gcc.gnu.org)|8.43.85.97|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/gcc/infrastructure ... done.
==> SIZE mpfr-2.4.2.tar.bz2 ... 1077886
==> PASV ... couldn't connect to 8.43.85.97 port 37636: Connection timed out
Retrying.
--2021-03-24 17:35:06-- ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
(try: 2) => 'mpfr-2.4.2.tar.bz2'
Connecting to gcc.gnu.org (gcc.gnu.org)|8.43.85.97|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/gcc/infrastructure ... done.
==> SIZE mpfr-2.4.2.tar.bz2 ... 1077886
==> PASV ... couldn't connect to 8.43.85.97 port 8918: Connection timed out
Retrying.
--2021-03-24 17:37:18-- ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
(try: 3) => 'mpfr-2.4.2.tar.bz2'
Connecting to gcc.gnu.org (gcc.gnu.org)|8.43.85.97|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/gcc/infrastructure ... done.
==> SIZE mpfr-2.4.2.tar.bz2 ... 1077886
==> PASV ... couldn't connect to 8.43.85.97 port 7904: Connection timed out
Retrying.
--2021-03-24 17:39:32-- ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
(try: 4) => 'mpfr-2.4.2.tar.bz2'
Connecting to gcc.gnu.org (gcc.gnu.org)|8.43.85.97|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/gcc/infrastructure ... done.
==> SIZE mpfr-2.4.2.tar.bz2 ... 1077886
==> PASV ... ^C
[luban@k8s-deploy-6ph3mb-1616471870889-7d64d9dc66-w579j gcc-4.9.4]$
Solution
Change download source
The file ./contrib/download_prerequisites
strings:
ftp://gcc.gnu.org/pub/gcc/infrastructure
Replaced by:
http://www.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure
Reference link: