FedoraRHEL Based

How To Install GCC on Fedora 43

Install GCC on Fedora 43

You’re setting up a fresh Fedora 43 system, ready to compile your first C program — and then you get hit with gcc: command not found. It’s a frustrating but completely fixable problem that almost every Linux developer runs into. This guide walks you through exactly how to install GCC on Fedora 43, covering three different installation methods, how to verify everything works, how to compile a real program, and how to fix the most common issues.

GCC, or the GNU Compiler Collection, is one of the most important tools in the Linux ecosystem. It’s the default compiler for C, C++, Fortran, Ada, Go, and several other languages. Nearly all Linux software — including the kernel itself — is built with GCC. On Fedora 43, the GNU toolchain has been updated to GCC 15.2, bundled with glibc 2.42, binutils 2.45, and GDB 16.3 as part of the official Fedora 43 GNU Toolchain update.

Fedora 43 also ships with DNF5 as its default package manager, replacing DNF4. This matters because some command syntax has changed — especially for group installs. This guide uses the correct DNF5 syntax throughout, so you won’t waste time debugging outdated commands.

Whether you’re a sysadmin configuring a Linux server tutorial environment, a student writing your first C program, or a developer setting up a CI build machine, this guide covers everything you need. We’ll go step by step: updating your system, installing GCC three different ways, verifying the install, compiling a test program, installing companion tools, and resolving the most common errors.

Prerequisites Before You Install GCC on Fedora 43

Before running any commands, make sure you have the following in place:

  • Fedora 43 installed (Workstation, Server, or minimal ISO)
  • A user account with sudo privileges or direct root access
  • An active internet connection (DNF needs to reach Fedora’s package mirrors)
  • Access to a terminal emulator — GNOME Terminal, Konsole, or an SSH session all work
  • Basic comfort with Linux command-line navigation

You can confirm you’re running Fedora 43 with:

cat /etc/os-release

Expected output:

NAME="Fedora Linux"
VERSION="43 (Workstation Edition)"
ID=fedora
VERSION_ID=43

You can also confirm that DNF5 is active:

dnf --version

Expected output will begin with dnf5 version 5.x.x. If you see 4.x, you’re on DNF4 — some syntax in this guide will differ slightly for your system.

Step 1: Update Your Fedora 43 System

Always update your system before installing new software. This refreshes package metadata, applies pending security patches, and prevents dependency conflicts during installation. Skipping this step is one of the most common causes of broken installs.

Run the following command:

sudo dnf update

DNF5 will calculate available upgrades and show you a transaction summary. Review it, then type y and press Enter to confirm.

Why This Step Matters

If your system has a pending kernel update, reboot after updating before you install GCC. A kernel mismatch can cause issues when building kernel modules later.

sudo reboot

Once your system is back up, open a fresh terminal and proceed to the installation steps below.

Step 2: Install GCC on Fedora 43 — Choose Your Method

There are three ways to install GCC on Fedora 43, depending on what you actually need. Pick the one that fits your use case.

Method 1: Install GCC as a Single Package (Fastest)

This is the quickest option. It installs only the core gcc binary — ideal if you just need to compile C code and nothing else.

sudo dnf install gcc

DNF5 will automatically pull in all required dependencies and libraries. Once complete, confirm the installation:

gcc --version

Expected output:

gcc (GCC) 15.2.1 20251201 (Red Hat 15.2.1-2)
Copyright (C) 2025 Free Software Foundation, Inc.

Important: This method does NOT install g++, make, or gdb. If you need C++ support or a full build environment, use Method 2 below.

Method 2: Install GCC via the Development Tools Group (Recommended)

This is the recommended method for most developers. It installs GCC along with an entire suite of essential build tools in a single command — the most efficient way to configure GCC on Fedora 43 for serious development work.

The Development Tools group includes:

  • gcc — C compiler
  • gcc-c++ — C++ compiler (g++)
  • make — Build automation
  • gdb — GNU Debugger
  • git — Version control
  • binutils — Assembler and linker
  • autoconf, automake, patch, and more

On Fedora 43 with DNF5, use this command:

sudo dnf group install "Development Tools"

Or use the shorthand alias:

sudo dnf install @development-tools

Note for DNF4 users: Older Fedora guides show sudo dnf groupinstall "Development Tools" — this syntax still works on DNF5 as a compatibility alias, but the canonical DNF5 form is dnf group install.

After installation, verify the key tools are all present:

gcc --version
g++ --version
make --version
gdb --version

If all four commands return version numbers, your GCC on Fedora 43 setup is complete and fully operational.

Method 3: Install GCC C++ Compiler (g++) Separately

Already have gcc installed but need C++ support? You can install gcc-c++ as a standalone package — no need to reinstall the full group.

sudo dnf install gcc-c++

Verify it’s working:

g++ --version

This is useful when you’re building Qt applications, compiling open-source C++ projects from source, or working with CMake-based build systems. The gcc-c++ package is maintained as a separate RPM in Fedora’s repositories, so it can be installed independently at any time.

Step 3: Verify GCC Is Correctly Installed

Verifying your installation is not optional — it’s how you confirm the binary is in your $PATH and the correct version is active before you write a single line of code.

Run these three commands:

gcc --version
which gcc
man gcc
  • gcc --version — shows the GCC version number and build target
  • which gcc — confirms the binary location (should return /usr/bin/gcc)
  • man gcc — opens the full manual page; if this opens, GCC is fully functional
Screenshot of terminal showing gcc --version output on Fedora 43
Terminal output confirming GCC 15.2 is installed on Fedora 43

Expected output for which gcc:

/usr/bin/gcc

If which gcc returns nothing, GCC is not in your $PATH — this usually means the installation failed or you’re running under a restricted shell. Re-run the install command and check for errors.

Step 4: Write and Compile Your First C Program

This is where we prove everything actually works. Writing and compiling a real program is the most reliable way to validate your How To Install GCC on Fedora 43 setup from end to end.

Create the Source File

Open a text editor of your choice — nano is the easiest for beginners:

nano hello.c

Paste in the following C code:

#include <stdio.h>

int main() {
    printf("Hello, Fedora 43!\n");
    return 0;
}

Save and exit with Ctrl+O, then Enter, then Ctrl+X.

Compile with GCC

gcc hello.c -o hello

What this does:

  • gcc hello.c — tells GCC to compile the file hello.c
  • -o hello — names the output binary hello instead of the default a.out

If no errors appear, the binary compiled successfully.

Run the Program

./hello

Expected output:

Hello, Fedora 43!

Compile a C++ Test (Bonus)

If you installed gcc-c++, test it the same way:

nano hello.cpp
#include <iostream>

int main() {
    std::cout << "Hello from C++ on Fedora 43!" << std::endl;
    return 0;
}
g++ hello.cpp -o hello_cpp
./hello_cpp

Expected output:

Hello from C++ on Fedora 43!

Common beginner mistake: Forgetting the -o flag results in an output file named a.out — not an error, just easy to miss.

Step 5: Install Additional GCC-Related Libraries and Tools

The base GCC install covers most use cases, but if you’re doing systems programming, cross-compilation, or kernel module development on this Linux server tutorial environment, you’ll want a few more packages.

Package Install Command Purpose
GNU C Library headers sudo dnf install glibc-devel Low-level C system programming
Math library sudo dnf install libm-devel Floating-point and math functions
GDB Debugger sudo dnf install gdb Step-through debugging
CMake sudo dnf install cmake Cross-platform build system
32-bit GCC support sudo dnf install gcc.i686 glibc-devel.i686 Building 32-bit binaries on 64-bit system
Kernel dev headers sudo dnf install kernel-devel Kernel module compilation
Valgrind sudo dnf install valgrind Memory error detection

Install multiple packages in one shot:

sudo dnf install glibc-devel gdb cmake kernel-devel valgrind

Note on 32-bit support: Building 32-bit binaries on Fedora 43 can trigger multilib dependency conflicts. If you hit errors, try adding --allowerasing to the command or check the Fedora 43 multilib troubleshooting guide for version-specific fixes.

Step 6: Learn the Most Useful GCC Compilation Flags

Installing GCC is only half the job — knowing how to use it effectively is what makes you productive. Here are the flags every Fedora developer should know.

Essential GCC Flags

  • -o <name> — Set the output file name (e.g., -o myapp)
  • -Wall — Enable all common compiler warnings
  • -Wextra — Enable additional warnings beyond -Wall
  • -g — Embed debug symbols for use with GDB
  • -O0 — No optimization (best for debugging)
  • -O2 — Standard optimization for production builds
  • -O3 — Aggressive optimization (use carefully)
  • -std=c11 — Compile with C11 standard
  • -std=c++17 — Compile with C++17 standard
  • -m32 — Compile as a 32-bit binary
  • -shared — Build a shared library (.so file)

Real-World Example

A typical production compile command looks like this:

gcc -Wall -Wextra -O2 -std=c11 myprogram.c -o myprogram

For debugging sessions with GDB:

gcc -g -O0 -Wall myprogram.c -o myprogram_debug
gdb ./myprogram_debug

Troubleshooting Common GCC Installation Issues on Fedora 43

Even with the right commands, things go wrong. Here are the five most common errors and exactly how to fix them.

Error 1: gcc: command not found

Cause: GCC binary is not in $PATH, or the installation failed silently.

Fix:

sudo dnf install gcc
which gcc
echo $PATH

If which gcc returns nothing but the install appeared successful, your shell may be caching the old $PATH. Run:

hash -r

Or simply open a new terminal session.

Error 2: DNF5 Group Install Syntax Error

Symptom: Running sudo dnf groupinstall "Development Tools" returns a syntax error or “no such command.”

Cause: You’re mixing DNF4 syntax on a DNF5 system (Fedora 43 uses DNF5 by default).

Fix: Use the correct DNF5 syntax:

sudo dnf group install "Development Tools"

Or the shorthand:

sudo dnf install @development-tools

Error 3: 32-bit gcc-c++.i686 Dependency Conflict

Symptom: DNF reports conflicting packages when trying to install gcc.i686 or glibc-devel.i686.

Cause: Multilib conflicts are common on Fedora 43 when mixing 32-bit and 64-bit toolchain packages.

Fix:

sudo dnf install gcc.i686 glibc-devel.i686 --allowerasing

If the conflict persists, check what’s causing it:

sudo dnf install gcc.i686 --setopt=strict=0

Alternatively, use a container or mock environment for 32-bit builds to avoid system-level conflicts entirely.

Error 4: Old GCC Version Shown After Install

Symptom: gcc --version shows an older version even after installing.

Cause: System was not updated before installation, or a cached version is still active.

Fix:

sudo dnf update gcc
gcc --version

If you still see an old version, check if there are multiple GCC binaries:

ls /usr/bin/gcc*
sudo alternatives --config gcc

Error 5: make: command not found After Installing GCC

Symptom: GCC works, but make is missing.

Cause: You used Method 1 (single package install), which does not include make.

Fix: Install the full Development Tools group or install make individually:

sudo dnf install make

How to Keep GCC Updated on Fedora 43

GCC updates on Fedora 43 flow through the standard DNF package repository — no special PPAs or third-party repos needed.

To update GCC specifically:

sudo dnf upgrade gcc

To update your entire system (recommended):

sudo dnf update

For server environments where you want automatic security updates, enable dnf-automatic:

sudo dnf install dnf-automatic
sudo systemctl enable --now dnf-automatic-install.timer

Fedora 43 currently ships GCC 15.2 — the most recent release in the GCC 15.x series as of the Fedora 43 GNU Toolchain update. Staying updated ensures you get the latest language standard support, security patches, and optimization improvements.

GCC vs. Clang on Fedora 43: Which Should You Use?

This question comes up constantly. Here’s the short answer: use GCC as your default, consider Clang for specific use cases.

Feature GCC 15.2 (Fedora 43) Clang/LLVM
Default on Fedora 43 ✅ Yes ❌ Optional install
C/C++ standard support ✅ Full (C23, C++23) ✅ Full
Error message readability ⚠️ Verbose ✅ More user-friendly
Linux kernel compilation ✅ Required ⚠️ Experimental
Link-time optimization -flto -flto
Sanitizers (AddressSan, etc.) ✅ Supported ✅ Excellent
Cross-compilation support ✅ Mature ✅ Mature

GCC remains the gold standard for kernel development, system-level programming, and anything that requires deep integration with the GNU toolchain. Clang is excellent for C++ application development where clean diagnostics speed up iteration.

Congratulations! You have successfully installed GCC. Thanks for using this tutorial for installing the GCC (GNU Compiler Collection) on your Fedora 43 Linux system. For additional help or useful information, we recommend you check the official GCC website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button