yum group install "Development Tools" yum install redhat-lsb rpm-build rpm-sign check dejagnu expect zlib-devel [root@localhost github.com]# git clone https://github.com/BobSteagall/gcc-builder.git Cloning into 'gcc-builder'... remote: Enumerating objects: 215, done. remote: Total 215 (delta 0), reused 0 (delta 0), pack-reused 215 Receiving objects: 100% (215/215), 35.75 KiB | 0 bytes/s, done. Resolving deltas: 100% (149/149), done.
[root@localhost github.com]# cd gcc-builder/
[root@localhost gcc-builder]# git checkout gcc6 Branch gcc6 set up to track remote branch gcc6 from origin. Switched to a new branch 'gcc6'
[root@localhost gcc-builder]# vi gcc-build-vars.sh export GCC_VERSION=6.3.0
root@localhost gcc-builder]# vi configure-gcc.sh
elif [ "$GCC_PLATFORM" == "Linux" ]
then
$GCC_SRC_DIR/configure -v
--with-pkgversion="$GCC_PKG_NAME"
--enable-default-pie \ ---增加enable-default-pie
--enable-languages=c,c++ \
[root@localhost gcc-builder]# ./build-gcc.sh | tee build.log
[root@localhost gcc-builder]# ./stage-gcc.sh
[root@localhost gcc-builder]# ./pack-gcc.sh
[root@localhost gcc-builder]# cd dist/usr/local [root@localhost local]# cp -r bin/ gcc/ /usr/local/ [root@localhost local]# chown -R root:root /usr/local/gcc/6.3.0/ [root@localhost local]# chown root:root /usr/local/bin/gcc630 [root@localhost local]# source /usr/local/bin/setenv-for-gcc630.sh [root@localhost local]# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc/6.3.0/libexec/gcc/x86_64-kewb-linux-gnu/6.3.0/lto-wrapper Target: x86_64-kewb-linux-gnu Configured with: /usr/local/docker/src/github.com/gcc-builder/gcc-6.3.0/configure -v --with-pkgversion='KEWB Computing Build' --prefix=/usr/local/gcc/6.3.0 --program-suffix= --enable-tls --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-default-pie --enable-languages=c,c++ --enable-lto --enable-bootstrap --disable-nls --disable-multilib --disable-install-libiberty --disable-werror --with-system-zlib Thread model: posix gcc version 6.3.0 (KEWB Computing Build)