GNU GCC

GNU[1] [2] is an operating system that is free software—that is, it respects users' freedom. The GNU operating system consists of GNU packages (programs specifically released by the GNU Project) as well as free software released by third parties. The development of GNU made it possible to use a computer without software that would trample your freedom.

GNU Compiler Collection (GCC)

As of May 2021, the recent 11.1 release of GCC includes front ends for C (gcc), C++ (g++), Objective-C, Fortran (gfortran), Ada (GNAT), Go (gccgo) and D (gdc, since 9.1) programming languages, with the OpenMP and OpenACC parallel language extensions being supported since GCC 5.1. Versions prior to GCC 7 also supported Java (gcj), allowing compilation of Java to native machine code. Modula-2 support, previously offered by third parties, will be merged into GCC 13. Regarding language version support for C++ and C, since GCC 11.1 the default target is gnu++17, a superset of C++17, and gnu11, a superset of C11, with strict standard support also available. GCC also provides experimental support for C++20 and upcoming C++23. [3]

Installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
############################## Directory Listing ############################
export HOME=`pwd`
export download_DIR=$HOME/download_DIR/
export libs_DIR=$HOME/Library/

echo $HOME
echo $download_DIR
echo $libs_DIR

mkdir -p download_DIR
mkdir -p Library

############################## GCC ############################
cd $download_DIR

gcc_version="12.2.0" # 4.8.5/8.3.0/9.3.0/10.3.0/12.2.0

wget -c --no-check-certificate https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.gz
tar -xvf gcc-${gcc_version}.tar.gz
cd gcc-${gcc_version}

./contrib/download_prerequisites
./configure --prefix=$libs_DIR/gcc-v${gcc_version} --enable-languages=c,c++,fortran --disable-multilib

make
make -j && make install
gcc --version

echo "==================="
export PATH=$PATH:/$libs_DIR/gcc-v${gcc_version}/bin
gcc --version

Bug and Error

Bug: configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.???

1
2
3
# Inside the gcc directory, do this command:
./contrib/download_prerequisites
# After that script, GMP, MPFR, and MPC will be ready to use. Continue with ./configure.


GNU GCC
https://waipangsze.github.io/2023/04/25/GNU/
Author
wpsze
Posted on
April 25, 2023
Updated on
October 8, 2024
Licensed under