In this tutorial, we will be discussing what are Development tools, why we need them, and how to install development tools in Linux distributions such as Arch Linux, CentOS, RHEL, Fedora, AlmaLinux, Rocky Linux, Debian, Ubuntu, and openSUSE etc.
Table of Contents
What are Development Tools?
Development tools are essential for compiling, building, and installing software from source code. These development tools include all necessary applications, such as GNU GCC C/C++ compilers, make, debuggers, man pages and others which are needed to compile and build new software and packages.
Here’s a detailed explanation of their purposes and roles:
Purpose of Development Tools
1. Compilation:
- Compilers: Convert human-readable source code (written in languages like C, C++, etc.) into machine-readable binary code that can be executed by the computer’s CPU. The GNU Compiler Collection (GCC) is a common compiler used for this purpose.
- Preprocessors: Process directives in the source code before actual compilation starts. They handle tasks like including files, macro substitutions, etc.
2. Building:
- Make: A build automation tool that reads a
Makefile
to determine how to compile and link the program. It ensures that only the necessary parts of the program are recompiled, saving time during the build process. - Linkers: Combine multiple object files (compiled source code) into a single executable program or library. This step resolves references between different parts of the program.
3. Libraries and Headers:
- Development Libraries: Provide pre-written code that developers can use to handle common tasks (e.g., handling network connections, file I/O, etc.). These libraries often come with associated header files that declare the functions and structures available in the library.
- Header Files: Contain declarations for functions, macros, and data structures used in the program. They are included in source files to provide the necessary declarations for the compiler.
4. Configuration:
- Autoconf: A tool for producing
configure
scripts that automatically adapt the software to various types of systems. Theconfigure
script checks the system environment and sets up the necessary build options. - Automake: Generates
Makefile.in
templates for use withautoconf
. It simplifies the writing ofMakefile
templates that are portable across different systems.
5. Debugging and Profiling:
- Debuggers: Tools like GDB (GNU Debugger) help developers find and fix bugs in their programs by allowing them to inspect the state of the program at runtime, set breakpoints, and step through code.
- Profilers: Tools that analyze the program’s performance, helping developers identify bottlenecks and optimize the code.
Examples of Development Tools
- GNU Compiler Collection (GCC): A suite of compilers for various programming languages, including C and C++.
- Make: A build automation tool that reads
Makefile
to compile and link the program. - GDB: The GNU Debugger for debugging programs.
- Autoconf and Automake: Tools for generating portable build scripts and makefiles.
- Pkg-config: A helper tool used when compiling applications and libraries to manage library paths and dependencies.
- Development Libraries: Such as
libssl-dev
(for SSL/TLS support),zlib1g-dev
(for compression), and others.
Why Development Tools Are Needed
When you install software from source, you start with raw source code files. The development tools perform the following tasks to convert these files into a working program:
1. Prepare the Build Environment:
Tools like autoconf
and automake
prepare the build environment by generating necessary configuration scripts and makefiles.
2. Compile Source Code:
The compiler translates source code into object files.
3. Link Object Files:
The linker combines object files into an executable program or a library.
4. Install the Program:
The make install
command copies the compiled program and its related files to the appropriate directories on the system.
Hope you got a basic understanding of Development tools. Let us now see how to install them in various Linux distributions.
Install Development Tools in Linux
The developer tools can be installed either individually one by one or all at once. We are going to install all at once to make things much easier.
1. Install Development Tools in Arch Linux and Derivatives
To install development tools in Arch Linux and its derivatives like EndeavourOS and Manjaro Linux, just run:
$ sudo pacman -Syyu
$ sudo pacman -S base-devel
The above command will install the following package(s) in your Arch-based systems.
- autoconf
- automake
- binutils
- bison
- fakeroot
- file
- findutils
- flex
- gawk
- gcc
- gettext
- grep
- groff
- gzip
- libtool
- m4
- make
- pacman
- patch
- pkg-config
- sed
- sudo
- texinfo
- util-linux
- which
Just hit ENTER to install all of them.
If you want to install to a specific package group, just type its number and hit ENTER to continue installation.
2. Install Development Tools in Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux
To install development tools in Fedora, RHEL and its clones such as CentOS, AlmaLinux and Rocky Linux, run the following commands as root user.
$ sudo dnf update
$ sudo dnf groupinstall "Development Tools"
Install Additional Libraries:
$ sudo dnf install openssl-devel zlib-devel
On RHEL 7 and older versions, use the following commands:
$ sudo yum update
$ sudo yum groupinstall "Development Tools"
The above command is going to install all necessary developer tools, such as:
- autoconf
- automake
- bison
- byacc
- cscope
- ctags
- diffstat
- doxygen
- elfutils
- flex
- gcc/gcc-c++/gcc-gfortran
- git
- indent
- intltool
- libtool
- patch
- patchutils
- rcs
- subversion
- swig
Install Additional Libraries:
$ sudo yum install openssl-devel zlib-devel
3. Install Development Tools in Debian, Ubuntu and Derivatives
To install required developer tools in Debian-based systems, run:
$ sudo apt update
$ sudo apt install build-essential
This command will all necessary packages to setup the development environment in Debian, Ubuntu and its derivatives.
- binutils
- cpp
- gcc-5-locales
- g++-multilib
- g++-5-multilib
- gcc-5-doc
- gcc-multilib
- autoconf
- automake
- libtool
- flex
- bison
- gdb
- gcc-doc
- gcc-5-multilib
- and many.
Depending on the software, you might need other libraries. Common ones include libssl-dev
, zlib1g-dev
, etc.
$ sudo apt install libssl-dev zlib1g-dev
You now have the necessary development tools to develop a software in your Linux box.
If you don't like this method to install the development tools, there is also a script named “mangi script” available to easily setup development environment in DEB based systems such as Ubuntu, Linux Mint and other Ubuntu derivatives. For more details, refer the following guide.
4. Install Development Tools in openSUSE/SUSE
To setup development environment in openSUSE and SUSE enterprise, run the following commands as sudo or root user:
$ sudo zypper refresh
$ sudo zypper update
$ sudo zypper install -t pattern devel_C_C++
Verifying Installation
Now, Let us verify the development tools have been installed or not. To do so, run:
$ gcc -v
$ make -v
As you see in the above output, the development tools have been successfully installed in Linux. Start compiling your applications from source code!