~2 min read • Updated Jul 20, 2025

1. Introduction


Compiling software allows Linux users to build programs directly from source code, gaining access to newer versions or unavailable packages. It involves translating human-readable code into executable files using compilers and linkers.


2. Why Compile Software?


  • Availability: Some programs aren't packaged in distribution repositories
  • Timeliness: Building from source gives access to the latest versions and features

3. What Is Compiling?


Compilation transforms high-level languages like C into machine language. It involves:

  • Compiler: Converts code to assembly and then to object files
  • Linker: Combines object files with shared libraries into executables

Interpreted languages (like Python) run code directly without compilation.


4. Tools Required


  • gcc: GNU C Compiler
  • make: Automates build using Makefiles
  • Development packages: Meta-packages like build-essential on Debian include necessary tools

To check if gcc is installed:

which gcc

5. Step-by-Step Example: Building the diction Program


Step 1: Download Source Code

mkdir ~/src
cd ~/src
wget https://ftp.gnu.org/gnu/diction/diction-1.11.tar.gz
tar xzf diction-1.11.tar.gz
cd diction-1.11

Step 2: Explore Source Tree

Files include README, INSTALL, .c (source), .h (headers), configure, and Makefile.in. View source with:

less diction.c

Step 3: Configure the Build

./configure

Generates Makefile and config.h. View instructions in:

less Makefile

Step 4: Build with make

make

Compiles source into executables. To test timestamp behavior:

rm getopt.o
make
touch getopt.c
make

Step 5: Install the Program

sudo make install

Installs to /usr/local/bin. Verify with:

which diction
man diction

6. How make Works


make uses dependency rules to rebuild only when needed. Sample rule:

diction: diction.o sentence.o misc.o getopt.o getopt1.o
	$(CC) -o $@ $(LDFLAGS) ... $(LIBS)

.c.o: defines how .c files compile to .o:

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<

7. Conclusion


Compiling software in Linux involves downloading source, configuring the build, compiling with make, and installing. This guide helps users understand and perform compilation using the diction program as an example—unlocking the full power of open-source computing.


Written & researched by Dr. Shahin Siami