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

How to install build-essential on openSUSE

Coming from Debian or Ubuntu and interested in building C or C++ software programs on openSUSE? You’ll probably frantically search for a way to install package build-essential on openSUSE. Only to realize that this package does not exist on openSUSE. No worries though, because openSUSE 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 doing a fair bit of distro hopping. While doing so, I can highly recommend giving openSUSE a try. They offer openSUSE Leap and openSUSE Tumbleweed. As a long term release (LTS), Leap works great on both servers and desktop machines. Tumbleweed on the other hand is a rolling release that always offers you the latest and greatest software version. Not what you want on a server, but definitely worth checking out for desktop usage, if you’re a Linux enthusiast. The article about 5 things to do after installing openSUSE Tumbleweed gets you started.

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 openSUSE? 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 openSUSE? Read on as this article answers exactly that question.

What do you need

For this article you just need an openSUSE Leap or Tumbleweed system. If you haven’t installed openSUSE yet, consider setting it up as a virtual machine in VirtualBox. You can download the Leap and Tumbleweed ISO images for free from the openSUSE website. Both distributions are great and hidden gems in my opinion:

  • Easy-to-use, yet powerful installer.
  • A breeze to configure thanks to YaST.
  • Easy to fix thanks to automatically created Btrfs snapshots and the seamlessly integrated snapper tool.
  • Automated quality assurance on every release with the help of openQA.

I currently run openSUSE Tumbleweed on my workstation and couldn’t be happier. If you plan on running openSUSE on a server or prefer stable versions for your software, go for openSUSE Leap instead. For this article, I’ll use openSUSE Leap 15.3 running as a virtual machine.

Installing pattern devel_basis on openSUSE

The trick to installing the equivalent of Debian/Ubuntu’s build-essential on openSUSE is the installation of pattern devel_basis. Patterns on openSUSE represent a common group of packages, to conveniently install a certain type of functionality on your system. Pattern devel_basis represent the Base Development related functionality and is close to what meta-package build-esssential installs on Debian/Ubuntu.

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

  • zypper search -t pattern
Terminal screenshot that shows the output of command "zypper search -t pattern" to list all available and installable patterns on openSUSE Leap or Tumbleweed.

To view information about the contents of pattern devel_basis, run this command from the terminal:

  • zypper info -t pattern devel_basis

On my system the output looks like this:

Information for pattern devel_basis:
------------------------------------
Repository      : openSUSE-Leap-15.3-1
Name            : devel_basis
Version         : 20170319-lp153.1.16
Arch            : x86_64
Vendor          : openSUSE
Installed       : No
Visible to User : Yes
Summary         : Base Development
Description     : 
    Minimal set of tools for compiling and linking applications.
Contents        : 
    S | Name                            | Type    | Dependency
    --+---------------------------------+---------+------------
      | autoconf                        | package | Required
      | automake                        | package | Required
    i | binutils                        | package | Required
      | bison                           | package | Required
    i | cpp                             | package | Required
      | flex                             | package | Required
      | gcc                             | package | Required
      | gdbm-devel                      | package | Required
      | gettext-tools                   | package | Required
      | glibc-devel                     | package | Required
      | libtool                         | package | Required
      | m4                              | package | Required
      | make                            | package | Required
      | makeinfo                        | package | Required
      | ncurses-devel                   | package | Required
      | patch                           | package | Required
    i | patterns-base-basesystem        | package | Required
      | patterns-devel-base-devel_basis | package | Required
      | zlib-devel                      | package | Required
      | bin86                           | package | Recommended
      | binutils-devel                  | package | Recommended
      | e2fsprogs-devel                 | package | Recommended
    i | fdupes                          | package | Recommended
      | gcc-c++                         | package | Recommended
      | gcc-info                        | package | Recommended
      | git                             | package | Recommended
      | glibc-info                      | package | Recommended
      | gmp-devel                       | package | Recommended
      | gperf                           | package | Recommended
      | libaio-devel                    | package | Recommended
      | libapparmor-devel               | package | Recommended
      | libdb-4_8-devel                 | package | Recommended
      | libosip2-devel                  | package | Recommended
      | libstdc++-devel                 | package | Recommended
      | openldap2-devel                 | package | Recommended
      | pam-devel                       | package | Recommended
      | patch                           | package | Recommended
    i | pkg-config                       | package | Recommended
      | subversion                      | package | Recommended

Installing pattern devel_basis with zypper in the terminal

To install pattern devel_basis from the command line with the help of zypper, run this command in the terminal:

  • sudo zypper install -t pattern devel_basis
Terminal screenshot that shows you how to install the devel_basis pattern on openSUSE, which is the equivalent of build-essential on Debian and Ubuntu.

As you can see, this also install the gcc C and gcc-c++ C++ compilers on openSUSE, include the make utility for building software programs with the help of a Makefile.

Installing pattern devel_basis with YaST

YaST is a user-friendly graphical user interface application, allowing you to administer your openSUSE system. This includes the installation of new software packages and patterns. Perfect for those that prefer to work with graphical desktop applications, instead of directly in the terminal. To install pattern devel_basis with YaST, start YaST and select Software → Software Management:

Screenshot of YaST illustrating how to open the Software Management window, for installing new software packages and patterns.

This opens a new window labeled YaST2. Perform the following steps to install pattern devel_basison openSUSE:

  1. Select the Patterns tab.
  2. Scroll to the Base Development pattern and check its check-box.
  3. Click the Accept button to start the installation.
YaST screenshot that shows you how to insttall patterns devel_basis on openSUSE, which is the equivalent of build-essential on Debian and Ubuntu.

Additional tools for C and C++ development on openSUSE

By installing pattern devel_basis on openSUSE, 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.

The GDB debugger

While developing your C or C++ program, you’ll get to a point where you would like debugging functionality. Perfect for setting execution breakpoints, stepping through your code line-by-line and inspection variable values. For this you’ll need to install the gdb debugger tool on your openSUSE system:

  • sudo zypper install gdb

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 openSUSE system using this command:

  • sudo zypper 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 openSUSE 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 openSUSE system. It’s as simple as installing pattern devel_basis. You can view pattern devel_basis as the openSUSE equivalent of Debian/Ubuntu’s meta-package build-essential.

After installing pattern devel_basis, this article recommended the installation of a few other C / C++ development tools:

  • GDB debugger
  • CMake build environment generator
  • Visual Studio Code editor

By combining all these tools, you can use your openSUSE 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 →