---
# System prepended metadata

title: Compiling GCC and binutils

---

# Compiling GCC and binutils

Download and build the specific version of python of your preference from the [download page](https://www.python.org/downloads/).
In this example, I'll be using the latest version available as of the time of writing, which is 3.8.5.
Since I'm currently running CentOS 8 with python3.6.8 and gcc8.3.1, I feel inclined to install gcc10 along side the current gcc8 and build python3.8.5 with gcc10.

We'll be doing heavy compilation.
It's best to create a tmpfs for the purpose.
```
sudo mkdir /tmp2
sudo mount -o size=8G -t tmpfs none /tmp2
```
This should make the permission of `/tmp2` 777.

### Building gcc10

Read [this](https://gcc.gnu.org/wiki/InstallingGCC) and [this](https://stackoverflow.com/questions/9450394/how-to-install-gcc-piece-by-piece-with-gmp-mpfr-mpc-elf-without-shared-libra) first.
Then follow the [gcc installation guide](https://gcc.gnu.org/install/).

Consider this:"
I'll start by building gcc10 with the present gcc8.
This first build contains all new features of gcc10, but its binary is less optimized.
Then, I'll build a second gcc10 against the first gcc10.
This second build is the actual gcc10 to be deployed alongside the old gcc8."

The strategy described above is valid but unnecessary, as gcc adopts the [3-stage bootstrap](https://stackoverflow.com/questions/9429491/how-are-gcc-and-g-bootstrapped) by default.

#### [Prerequisite check](https://gcc.gnu.org/install/prerequisites.html)

1. ISO C++11 compiler (g\+\+ >= 4.8)
2. C standard library and headers (for target platform, i.e., x86_64 and x86_32)
3. ~~GNAT (to build the Ada compiler which we won't)~~
4. A “working” POSIX compatible shell, or GNU bash (bash)
5. A POSIX or SVR4 awk (>= 3.1.5)
6. GNU binutils ?
7. gzip (>= 1.2.4) or bzip2 (>= 1.0.2)
8. GNU make (>= 3.80)
9. GNU tar (>= 1.14)
10. Perl (5.6.1 ~ 5.6.24)
11. GMP devel (>= 4.3.2)
12. MPFR devel (>= 3.1.0)
13. MPC devel (>= 1.0.1)
14. isl devel (>= 0.15)
15. zstd devel

```
curl -LO https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
curl -LO https://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.xz
curl -LO https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.xz
curl -LO https://ftp.gnu.org/gnu/mpc/mpc-1.2.0.tar.gz
curl -LO http://isl.gforge.inria.fr/isl-0.22.1.tar.xz
curl -LO http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-10.2.0/gcc-10.2.0.tar.xz
curl -LO https://ftpmirror.gnu.org/binutils/binutils-2.35.tar.xz
```


```
mkdir /tmp/python3.8.5
```

```
cd /tmp2
mkdir srcdir
mkdir objdir
cd objdir

../srcdir/configure \
    --enable-languages=c,c++ \
    --with-multilib-list=m32,m64
```