Dependencies to Build Unrar from Source

Building the unrar utility directly from its official source code requires a minimal set of development tools and system libraries. This guide outlines the essential software packages, compilers, and utilities needed to prepare a system for compiling unrar, along with package manager commands for common Linux distributions.

Essential Build Requirements

The official unrar source code distributed by RARLAB is largely self-contained and does not rely on third-party compression or archive libraries. To compile it, you only need the fundamental C++ development toolchain:

  1. C++ Compiler: A modern C++ compiler such as GCC (g++) or Clang (clang++) capable of supporting standard C++ specifications.
  2. GNU Make: The make build automation tool to execute the build instructions defined in unrar's makefile.
  3. Standard C and C++ Libraries: Standard system runtime libraries (libc, libstdc++, or standard POSIX equivalents), which are included with standard developer toolchains.
  4. Archive Utilities (Optional): Tools such as tar to extract the unrarsrc archive and wget or curl to download it.

Installing Dependencies by Operating System

Depending on your distribution, these requirements can be installed via the system package manager:

Debian / Ubuntu

On Debian-based systems, the build-essential meta-package provides the necessary compiler and build utilities:

sudo apt update
sudo apt install build-essential wget

Fedora / RHEL / CentOS

On Red Hat-based distributions, install the basic development tools:

sudo dnf install gcc-c++ make wget tar

Alternatively, install the development group:

sudo dnf groupinstall "Development Tools"

Arch Linux

On Arch Linux, the base development package group contains all necessary dependencies:

sudo pacman -S base-devel wget

Alpine Linux

For lightweight environments like Alpine Linux, install the GNU C++ compiler and make:

apk add g++ make wget

Compiling unrar

Once the dependencies are installed, download and compile the source code:

  1. Download and extract the source archive:
    wget https://www.rarlab.com/rar/unrarsrc-6.2.12.tar.gz
    tar -xzf unrarsrc-*.tar.gz
    cd unrar
  2. Build the binary using the provided makefile:
    make -f makefile
  3. Install the compiled binary into your system path:
    sudo install -v -m755 unrar /usr/local/bin