前提须知

您需要一点准备:

  • 初中以上英语水平
  • 基本的 shell 交互能力
  • 熟悉搜索引擎 ( 指谷歌 ) 的使用
  • 知道如何使用 vim 编辑器

不建议不具备以上条件的人尝试部署

您还需知道 screen 如何使用, 这非常简单, 您可先花五分钟时间先看一下。

本教程适用于 Centos7 和 Oracle Linux 7,其它系统请用相应命令(如apt等)替换yum

安装前准备

yum -y install screen
yum clean all
yum makecache
screen -S gcc-install
yum -y groupinstall "Development tools"
yum -y install libmpc-devel mpfr-devel gmp-devel libmpc-devel zlib-devel* git vim gcc* wget epel-release
yum -y install bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev

编译安装 GCC 11.2.0

wget -c http://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
#国内推荐使用清华源
#wget -c https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
tar -xzvf gcc-11.2.0.tar.gz
cd gcc-11.2.0
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++,lto --enable-tls
make -j 4
#此处的4为CPU线程数,请根据自己VPS适度修改,如果不知,请删去-j 4
make install

编译参数解释

参数名含义可能值
disable-multilibSpecify that multiple target libraries to support different target variants, calling conventions, etc. should not be built. The default is to build a predefined set of them.``
enable-languages all, default, ada, c, c++, d, fortran, go, jit, lto, objc, obj-c++
enable-tlsSpecify that the target supports TLS (Thread Local Storage). Usually configure can correctly determine if TLS is supported. In cases where it guesses incorrectly, TLS can be explicitly enabled or disabled with --enable-tls or --disable-tls. This can happen if the assembler supports TLS but the C library does not, or if the assumptions made by the configure test are incorrect.
with-system-zlib

更多信息


LTO is not a default language, but is built by default because --enable-lto is enabled by default.
enable-languages 中的lto可以使用 --ebable-lto 代替
LTO: link-time optimization. This is enabled by default.

Some targets provide finer-grained control over which multilibs are built (e.g., --disable-softfloat):

arm--
fpu, 26bit, underscore, interwork, biendian, nofmult.

m68--*
softfloat, m68881, m68000, m68020.

mips--*
single-float, biendian, softfloat.

msp430--
no-exceptions

powerpc--, rs6000--
aix64, pthread, softfloat, powercpu, powerpccpu, powerpcos, biendian, sysv, aix.

最后修改:2021 年 08 月 27 日
如果觉得我的文章对你有用,请随意赞赏