[gcc] How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?

How do I install GCC (the GNU Compiler Collection) piece by piece, using the current version,
using the correct versions of dependencies, not using a package manager (like yum, rpm, apt, dpkg), and not using shared libraries?

Typical developers will likely want to install GCC the typical way, use your package manager (yum, rpm, apt, dpkg, port, brew, etc.) or follow the instructions here (http://gcc.gnu.org/wiki/InstallingGCC).

My question is how to install GCC piece by piece, without shared libraries.

  • I want a fully-independent GCC that can be moved around my system without using any shared libraries, and without creating any shared libraries.
  • This is what GCC calls "the difficult way" and it is not recommended for typical users.

GCC depends on:

  • GMP: GNU Multiple Precision Arithmetic Library
  • MPFR: GNU Multiple-precision floating-point rounding library
  • MPC: GNU Multiple-precision C library
  • ELF: Executable and Linkable Format library
  • PPL: Parma Polyhedra Library (optional, for memory optimizations)

This question is related to gcc elf gmp mpfr mpc

The answer is