Feature image for the article about how to install build-essential on Fedora

How to install build-essential on Fedora

Coming from Debian or Ubuntu and interested in building C or C++ software programs on Fedora? You’ll probably frantically search for a way to install package build-essential on Fedora. Only to realize that this package does not exist on Fedora. No worries though, because Fedora offers an alternative and equivalent approach to installing package build-essential. This tutorial shows you how.

Background

When starting with Linux, most users start out with an Ubuntu based distribution. Simply because the community flags these as beginner-friendly. At some point you might want to compile and install a software package from source code or develop software yourself in C or C++. For this you need at least the gcc, g++ and make programs installed.

You can install these necessary tools separately. However, the easiest way is by installing meta-package build-essential on Ubuntu (or Debian) based distributions:

  • sudo apt install build-essential

On Debian and Ubuntu, this meta-package installs a collection of development tools, needed to build software programs written in the C and C++ programming languages. Amongst other handy development tools and libraries, this includes the minimally needed programs gcc, g++ and make.

Moving forward on your Linux journey, you’ll likely end up dong a fair bit of distro hopping. While doing so, you should definitely include Fedora. Fedora offers a nice balance between a fixed release distribution (Ubuntu and Debian) and a rolling release distribution (openSUSE Tumbleweed and Arch). The Fedora team releases a new version of Fedora once every six months. They support each release for about thirteen months, so a bit over a year. This release schedule also enables you to always stay one release behind, if you want a bit less bleeding edge in exchange for stability.

When moving from an Ubuntu or Debian based distribution, one of the questions you’ll run into is: How do I install package build-essentialon Fedora? Shortly after, you’ll realize that this package doesn’t exist. The question then becomes: What is the alternative or equivalent of package build-essential on Fedora? Read on as this article answers exactly that question.

What do you need

For this article you just need a Fedora system. If you haven’t installed Fedora yet, consider setting it up as a virtual machine in VirtualBox. You can download the Fedora Workstation ISO image for free from the Fedora website. It comes with the Gnome desktop environment. For a different desktop environment, you can opt to download a Fedora spin for your preferred desktop environment.

Before installing any software on your Fedora system, you should first make sure that your system is up-to-date. You can do so by running these commands from the terminal:

  • sudo dnf check-update
  • sudo dnf upgrade

Installing the equivalent of build-essential on Fedora

Besides individual packages, Fedora offers package groups. Basically a set of packages grouped together to conveniently install a certain feature. The trick to installing the equivalent of Debian/Ubuntu’s build-essential on Fedora, is to find the package groups that provide similar functionality. These package groups are:

  • C Development Tools and Libraries
  • Development Tools

In case this got you curious about the availability of other groups on Fedora, run the following command from the terminal for a complete overview:

  • dnf group list --hidden

The command syntax to view information about a specific group:

  • dnf group info "GROUPNAME"

Example for the group C Development Tools and Libraries:

  • dnf group info "C Development Tools and Libraries"
Screenshot that illustrates how to use the "dnf group info" command to inspect the contents for the group "C Development Tools and Libraries".

The command syntax to install a specific group:

  • sudo dnf group install "GROUPNAME"

Knowing this, we can proceed with installing the groups C Development Tools and Libraries and Development Tools with command:

  • sudo dnf group install "C Development Tools and Libraries" "Development Tools"
Terminal screenshot that shows how use DNF to install the equivalent of build-essential on Fedora.

Additional tools for C and C++ development on Fedora

By installing the groups C Development Tools and Libraries and Development Tools on Fedora, you can now use development tools similar to what meta-package build-essential installs on Debian/Ubuntu. These tools enable you to compile C and C++ programs with the gcc and g++ compilers, respectively. It also enables you to build software programs based on a Makefile with make. While setting up your system for C and C++ development, you’ll probably want to install a few more additional tools.

CMake build environment generator

Many developers nowadays generate the build environment for their C and C++ programs with CMake. With the help of CMake, a developer can configure their C and C++ program in a platform independent way. This configuration is done inside a text file called CMakeLists.txt. Using this file as an input, CMake automatically detects the build tools installed on your system and generates the build environment accordingly. On Linux this typically results in an automatically generated Makefile, allowing you to build the software program with the help of make.

When starting the development of a new C or C++ program, I can highly recommend CMake from the get go. You install CMake on your Fedora system using this command:

  • sudo dnf install cmake

Visual Studio Code editor

The only missing puzzle piece for a productive C / C++ development environment is a powerful code editor. Several options exist here. Visual Studio Code, KDevelop, Netbeans, Geany, Eclipse CDT and JetBrains CLion to name just a few. Thanks to its large user base and numerous extensions, Visual Studio Code would be a good choice. You can find Fedora specific installation instructions of Visual Studio Code here.

For more information on combining CMake and the Visual Studio Code editor for your next C or C++ development project, refer to this tutorial:

It includes a template application that you can use as a starting point for your own C or C++ development project.

Wrap up

In this article you learned everything you need to know about installing C and C++ development tools on your Fedora system. It’s as simple as installing the groups C Development Tools and Libraries and Development Tools. You can view these groups as the Fedora equivalent of Debian/Ubuntu’s meta-package build-essential.

After installing the groups C Development Tools and Libraries and Development Tools, this article recommended the installation of a few other C / C++ development tools:

  • CMake build environment generator
  • Visual Studio Code editor

By combining all these tools, you can use your Fedora system for high-end C and C++ development in a user-friendly and productive way.

PragmaticLinux

Long term Linux enthusiast, open source software developer and technical writer.

View all posts by PragmaticLinux →