EMZETT.
Login

Building software from source (make, CMake)

In short: If there is no package you can translate a program from source code. Typical: install dependencies, configure, build, install.

In more detail: A compiler translates the source code into executable files. Build systems such as make and CMake automate this.

In detail

# classic (Autotools)
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install
 
# CMake
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
sudo cmake --install build
 
# Meson
meson setup build && ninja -C build && sudo ninja -C build install
  • Install location: to /usr/local, not /usr, so the package manager overwrites nothing.
  • Removing: make uninstall does not always exist. Better build a package with checkinstall or keep it in a container or directory (stow).
  • Requirements: build-essential, development packages (-dev or -devel).
  • Other languages: cargo build (Rust), go build, npm install, pip install.
  • Disadvantage: no automatic security updates.

See also: Important packages in the Linux base system, Dependencies and libraries