Forked from nchaigne/build-gcc-9.2.0-on-centos7.md
Last active
January 25, 2021 16:04
-
-
Save firewallzer0/321cbcbbaca0cc97052692385549a5d6 to your computer and use it in GitHub Desktop.
Revisions
-
firewallzer0 revised this gist
Jan 25, 2021 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,3 +61,6 @@ There are two ways to get devtoolset-9-toolchain get the RPM itself or install a >__`yum install centos-release-scl-rh`__<br> >__`yum install devtoolset-9-toolchain`__<br> Then you will need to run: >__`scl enable devtoolset-9 bash`__<br> -
firewallzer0 revised this gist
Jan 25, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ There are two ways to get devtoolset-9-toolchain get the RPM itself or install a >__`wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-toolchain-9.0-3.el7.x86_64.rpm`__<br> >__`rpm -i devtoolset-9-toolchain-9.0-3.el7.x86_64.rpm`__<br> ### OR >__`yum install centos-release-scl-rh`__<br> >__`yum install devtoolset-9-toolchain`__<br> -
firewallzer0 revised this gist
Jan 25, 2021 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,3 +51,13 @@ Notes: - Option `--disable-multilib` prevents building multiple target libraries (I don't need them, and it is simpler). - Option `--enable-langagues` allows to have a leaner and faster build if you only need (for example) C and C++. - See [GCC documentation](https://gcc.gnu.org/install/configure.html) for the full list of configure options. - To change the default compiler you will need the devtoolset-9-toolchain RPM. There are two ways to get devtoolset-9-toolchain get the RPM itself or install a repo that has it. I prefer the repo install. >__`wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-toolchain-9.0-3.el7.x86_64.rpm`__<br> >__`rpm -i devtoolset-9-toolchain-9.0-3.el7.x86_64.rpm`__<br> # OR >__`yum install centos-release-scl-rh`__<br> >__`yum install devtoolset-9-toolchain`__<br> -
nchaigne revised this gist
Oct 27, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ Required support libraries, listed hereafter, can be downloaded automatically us Notes: - If you have several processors available, you can benefit from a parallel build. For example, `make -j 6` will use 6 CPUs. (You might want to save a few for yourself, so you can do things on your server while gcc builds.) - Make sure you have enough space in `/home/build` (or whatever location you choose). You will need ~1 GB for gcc sources, ~6 GB for the build). Be prepared. - This will install gcc in `/usr/local/bin/gcc` (default prefix is `/usr/local`). Your distro gcc (`/usr/bin/gcc`) will not be overwritten, but if later on you need to invoke it, you will have to do so explicitly. Configure with option `--prefix` if you want to change this. - Option `--disable-multilib` prevents building multiple target libraries (I don't need them, and it is simpler). - Option `--enable-langagues` allows to have a leaner and faster build if you only need (for example) C and C++. -
nchaigne created this gist
Oct 27, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ # Building GCC 9.2.0 on CentOS 7 ## Introduction CentOS 7 distribution (as well as RHEL 7) ships with a somewhat outdated version of the GCC compiler (4.8.5 on CentOS 7.5), which may not be suitable to your compilation requirements. For example, [C11](https://gcc.gnu.org/wiki/C11Status) - which supersedes C99 - is fully supported only starting from GCC 4.9). Additionally, recent versions of GCC ([GCC6](https://gcc.gnu.org/gcc-6/changes.html), [GCC7](https://gcc.gnu.org/gcc-7/changes.html), [GCC8](https://gcc.gnu.org/gcc-8/changes.html), [GCC9](https://gcc.gnu.org/gcc-9/changes.html)) come with improvements which help detect issues at build time and offer suggestions on how to fix them. Sometimes, these are even actually helpful! This note describes how to build the latest GCC (9.2.0 as of October 2019) from sources on CentOS 7. This should be applicable as is on RHEL 7. For other Linux distributions, adapt as needed. While this is not overly complicated, building GCC takes quite some time. So you might want to plan to do something else while it builds... a coffee break just won't make it. ## Prerequisites Prerequisites are described here: https://gcc.gnu.org/install/prerequisites.html - C++ compiler >__`yum install gcc gcc-c++`__ Required support libraries, listed hereafter, can be downloaded automatically using script `download_prerequisites` included in the GCC archive. It's convenient, so we'll do that. - [GNU Multiple Precision Library](https://gmplib.org/) (GMP) version 4.3.2 (or later) - [MPFR Library](http://www.mpfr.org/) version 2.4.2 (or later) - [MPC Library](http://www.multiprecision.org/mpc/) version 0.8.1 (or later) - [ISL library](http://isl.gforge.inria.fr/) version 0.15 (or later) ## Build and install gcc >__`cd /home/build`__<br> >__`GCC_VERSION=9.2.0`__<br> >__`wget https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz`__<br> >__`tar xzvf gcc-${GCC_VERSION}.tar.gz`__<br> >__`mkdir obj.gcc-${GCC_VERSION}`__<br> >__`cd gcc-${GCC_VERSION}`__<br> >__`./contrib/download_prerequisites`__<br> >__`cd ../obj.gcc-${GCC_VERSION}`__<br> >__`../gcc-${GCC_VERSION}/configure --disable-multilib --enable-languages=c,c++`__<br> >__`make -j $(nproc)`__<br> >__`make install`__<br> Notes: - If you have several processors available, you can benefit from a parallel build. For example, `make -j 6` will use 6 CPUs. (You might want to save a few for yourself, so you can do things on your server while gcc builds.) - Make sure you have enough space in `/home/build` (or whatever location you choose). You will need ~700 MB for gcc sources, ~5.2 GB for the build). Be prepared. - This will install gcc in `/usr/local/bin/gcc` (default prefix is `/usr/local`). Your distro gcc (`/usr/bin/gcc`) will not be overwritten, but if later on you need to invoke it, you will have to do so explicitly. Configure with option `--prefix` if you want to change this. - Option `--disable-multilib` prevents building multiple target libraries (I don't need them, and it is simpler). - Option `--enable-langagues` allows to have a leaner and faster build if you only need (for example) C and C++. - See [GCC documentation](https://gcc.gnu.org/install/configure.html) for the full list of configure options.