If you want to install it as a local user

GNU GSRC provides an easy way to do so

Link: http://www.gnu.org/software/gsrc/

After configuration, simply specify the following commands:

cd gsrc
make -C pkg/gnu/gcc 
make -C pkg/gnu/gcc install

The second step could also be changed to speed up for an N-core system:

make -C pkg/gnu/gcc MAKE_ARGS_PARALLEL="-jN"
Answer from DanielY on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ linux-unix โ€บ gcc-command-in-linux-with-examples
gcc command in Linux with examples - GeeksforGeeks
October 4, 2025 - -std=c11 :This command will use the c11 version of standards for compiling the source.c program, which allows to define variable under loop initializations also using newer standards version is preferred. gcc -Wall -std=c11 source.c -o opt ยท -c : This command compile the program and give the object file as output, which is used to make libraries. -v : This option is used for the verbose purpose. Comment ยท Article Tags: Article Tags: Linux-Unix ยท
๐ŸŒ
Linux Man Pages
man7.org โ€บ linux โ€บ man-pages โ€บ man1 โ€บ gcc.1.html
gcc(1) - Linux manual page
If the description for a particular option does not mention a source language, you can use that option with all supported languages. The usual way to run GCC is to run the executable called gcc, or machine-gcc when cross-compiling, or machine-gcc-version to run a specific version of GCC. When you compile C++ programs, you should invoke GCC as g++ instead.
Discussions

c++ - Install gcc on linux with no root privilege - Stack Overflow
You need both the gcc-core and gcc-g++ to generate the c++ compiler (or the complete[=largest] package). The missing install-sh is in the gcc-core package. 2010-07-09T12:26:49.547Z+00:00 ... linuxfromscratch.org/lfs/view/stable may be useful for how-to get g++ building. More on stackoverflow.com
๐ŸŒ stackoverflow.com
c++ - Build a Linux executable using GCC - Stack Overflow
Keep in mind that before Linux systems will let you run the file, you may need to set its "executable bit": ... Also remember that on Linux, the extension of the file has very little to do with what it actually is - your executable can be named something, something.out, or even something.exe, and as long as it's produced by GCC ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Is installing GCC on Linux as complicated as I think it is?
sudo apt install gcc More on reddit.com
๐ŸŒ r/learnprogramming
13
8
June 14, 2017
Why GCC the linux compiler is being used for the Windows systems? What is the reason of its popularity?
It's a compiler, not necessarily a Linux specific one We use it to target Linux binaries and ARM cortex-m binaries. We use clang(-cl) to target Linux and Windows (from a Linux container). More on reddit.com
๐ŸŒ r/cpp_questions
26
5
December 17, 2023
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ linux-linux-gcc-command-with-practical-examples-422697
Linux gcc Command with Practical Examples | LabEx
In this lab, you first learned the basics of the GCC (GNU Compiler Collection) compiler, including how to check the installed version and the common command-line options such as -c, -o, -g, -Wall, -Werror, and -O<n>. You then practiced compiling ...
๐ŸŒ
iO Flood
ioflood.com โ€บ blog โ€บ gcc-linux-command
GCC Command Guide: How-To Compile C Code in Linux
December 12, 2023 - The GCC command, also known as the GNU Compiler Collection, is a key component of the Linux ecosystem. Itโ€™s not just a simple command but a full-fledged collection of compilers for various programming languages, with C and C++ being the most ...
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ is installing gcc on linux as complicated as i think it is?
r/learnprogramming on Reddit: Is installing GCC on Linux as complicated as I think it is?
June 14, 2017 -

Disclaimer: I am not well versed at Linux at all. Please pardon my ignorance.

I'm trying to figure out how to install GCC onto my macbook running Ubuntu 16.04. However after reading through the 6 steps to install GCC outlined on the GCC website I am at a total loss. I understand maybe 50% of the words on these pages. There are so many prerequisites and so many software requirements and so many technical things you have to set up that there is basically no hope in me figuring this out unless I extensively google every other word within the instructions. I would like to install it myself without the use of some sort of installer, but if it's this complicated to do so then I may have quite a bit of googling to do.

My question is this. What are the general guidelines I need to know to install GCC on Linux? I'm not asking for a "step-by-step how-to" guide. I'd just like a general overview on how one goes about installing GCC on their own. I understand I need some required software installed, I need to check and see if my physical CPU is compatible (real confusing), I need figure out in what directory I want to install GCC in, I need to figure out how to build GCC (this is real confusing) and I need to figure out a whole lotta stuff that I don't even know about yet. Perhaps it isn't as hard as it seems. Maybe this way of installing GCC is hard mode that nobody does. Or maybe this is the standard way that everyone uses. I don't know and would greatly appreciate any help or advice you all may have. Thanks!

๐ŸŒ
University of Alabama
oit.ua.edu โ€บ software โ€บ gcc
GCC - Office of Information Technology | The University of Alabama
The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain and the standard compiler for most projects related to GNU and Linux, including the Linux kernel.
๐ŸŒ
Greenwebpage
greenwebpage.com โ€บ home โ€บ blog โ€บ how to install gcc compiler on linux
How to Install GCC Compiler on Linux - Greenwebpage Community
July 4, 2024 - GCC, the GNU Compiler Collection, is an essential component of the development system for Linux-based distributions and other operating systems. It provides front ends for programming languages such as C and C++. Installing GCC on Ubuntu 24.04 ...
๐ŸŒ
Reddit
reddit.com โ€บ r/cpp_questions โ€บ why gcc the linux compiler is being used for the windows systems? what is the reason of its popularity?
r/cpp_questions on Reddit: Why GCC the linux compiler is being used for the Windows systems? What is the reason of its popularity?
December 17, 2023 - It's a compiler, not necessarily a Linux specific one We use it to target Linux binaries and ARM cortex-m binaries. We use clang(-cl) to target Linux and Windows (from a Linux container). ... GCC is the GNU compiler.
๐ŸŒ
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
๐ŸŒ
Wikihow
wikihow.com โ€บ computers and electronics โ€บ software โ€บ programming โ€บ c programming languages โ€บ how to compile a c program using the gnu compiler (gcc)
How to Use GCC to Compile a C Program on Linux and ...
2 weeks ago - The GNU C compiler, also known as GCC, is a simple Linux-based C compiler that's easy to use from the command line. If you're using Linux, including Ubuntu, Fedora, and Linux Mint, you can install GCC from your distribution's package manager.
๐ŸŒ
Medium
medium.com โ€บ @ihouelecaurcy โ€บ how-to-check-and-install-gcc-on-linux-complete-developer-guide-98697e2ab78f
How to Check and Install GCC on Linux: Complete Developer Guide | by Ihouele Caurcy | Medium
July 24, 2025 - sudo dnf install gcc # Or install complete development tools sudo dnf groupinstall "Development Tools" ... # Check system headers ls /usr/include/stdio.h >/dev/null 2>&1 && \ echo "โœ… Headers present" || \ echo "โŒ Headers missing" # Debian/Ubuntu sudo apt install libc6-dev linux-libc-dev
๐ŸŒ
Incredibuild
incredibuild.com โ€บ home โ€บ integrations โ€บ gcc
What is GNU Compiler Collection (GCC) | Incredibuild
September 17, 2024 - GCC is the heart of the GNU toolchain, the development system used to compile most Linux and open-source software. While there are a few specialty distributions that omit GCC, you will find it in nearly every Linux system.The Linux kernel itself ...
๐ŸŒ
Linux Mint Forums
forums.linuxmint.com โ€บ board index โ€บ main edition support โ€บ beginner questions
Installing gcc and g++ - Linux Mint Forums
March 23, 2019 - I get the same results with gcc. I've tried sudo apt-get install mediainfo mediainfo-gui open jdk-8-jre wget ffmpeg x264 x265 (to install java) This produces the following errors E: unable to locate package open. E:unable to locate package jdk-8-jre Please help, I am not normally interested in point & click stuff (GUI) . I normally drop to a terminal for all my Unix (now Linux...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ installation guide โ€บ how-to-install-gcc-compiler-on-linux
How to Install GCC Compiler on Linux? - GeeksforGeeks
July 23, 2025 - Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC.
๐ŸŒ
Linux From Scratch
linuxfromscratch.org โ€บ blfs โ€บ view โ€บ svn โ€บ general โ€บ gcc.html
GCC-15.2.0
case $(uname -m) in x86_64) sed -i.orig '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 ;; esac mkdir build && cd build && ../configure \ --prefix=/usr \ --disable-multilib \ --with-system-zlib \ --enable-default-pie \ --enable-default-ssp \ --enable-host-pie \ --disable-fixincludes \ ...
Top answer
1 of 1
5

You should be able to build the Linux kernel with a pretty old version of GCC, probably back as far as GCC 3.2. The top-level README file in Linux 4.9.4 mentions:

 - Make sure you have at least gcc 3.2 available.
   For more information, refer to Documentation/Changes.

And Documentation/Changes gives a list of required versions of GCC (listed as "GNU C") and the other build dependencies for Linux, as well as how to check what version of each you currently have installed:

====================== ===============  ========================================
        Program        Minimal version       Command to check the version
====================== ===============  ========================================
GNU C                  3.2              gcc --version
GNU make               3.80             make --version
binutils               2.12             ld -v
util-linux             2.10o            fdformat --version
module-init-tools      0.9.10           depmod -V
e2fsprogs              1.41.4           e2fsck -V
jfsutils               1.1.3            fsck.jfs -V
reiserfsprogs          3.6.3            reiserfsck -V
xfsprogs               2.6.0            xfs_db -V
squashfs-tools         4.0              mksquashfs -version
btrfs-progs            0.18             btrfsck
pcmciautils            004              pccardctl -V
quota-tools            3.09             quota -V
PPP                    2.4.0            pppd --version
isdn4k-utils           3.1pre1          isdnctrl 2>&1|grep version
nfs-utils              1.0.5            showmount --version
procps                 3.2.0            ps --version
oprofile               0.9              oprofiled --version
udev                   081              udevd --version
grub                   0.93             grub --version || grub-install --version
mcelog                 0.6              mcelog --version
iptables               1.4.2            iptables -V
openssl & libcrypto    1.0.0            openssl version
bc                     1.06.95          bc --version
Sphinx\ [#f1]_         1.2              sphinx-build --version
====================== ===============  ========================================

.. [#f1] Sphinx is needed only to build the Kernel documentation

It's a good idea to check the Documentation/Changes file in the kernel source you're actually planning on compiling.

With all that said, it's probably a good idea to use a relatively recent version of GCC, since newer versions have better optimizers and thus can often produce faster code, and since newer versions have more readable diagnostics so it may be easier to figure out what went wrong of your build fails.

In general, I recommend using the version of GCC that is officially packaged for your system. In Ubuntu, the version of GCC that is installed as a dependency of the build-essential metapackage should always be sufficient, at least for building kernels that aren't far newer than the kernel officially packaged for your system.

๐ŸŒ
Ubuntu
documentation.ubuntu.com โ€บ ubuntu-for-developers โ€บ howto โ€บ gcc-setup
How to set up a development environment for GCC on Ubuntu - Ubuntu for Developers
December 2, 2025 - The GNU Compiler Collection (GCC) is a set of compilers for programming languages, including C, C++, Assembly, and many more. It is the ยท de facto standard in Linux environments and is used to compile both the GNU toolchain and the Linux kernel.