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:
- C++ Compiler: A modern C++ compiler such as GCC
(
g++) or Clang (clang++) capable of supporting standard C++ specifications. - GNU Make: The
makebuild automation tool to execute the build instructions defined in unrar'smakefile. - Standard C and C++ Libraries: Standard system
runtime libraries (
libc,libstdc++, or standard POSIX equivalents), which are included with standard developer toolchains. - Archive Utilities (Optional): Tools such as
tarto extract theunrarsrcarchive andwgetorcurlto 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 wgetFedora / RHEL / CentOS
On Red Hat-based distributions, install the basic development tools:
sudo dnf install gcc-c++ make wget tarAlternatively, 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 wgetAlpine Linux
For lightweight environments like Alpine Linux, install the GNU C++ compiler and make:
apk add g++ make wgetCompiling unrar
Once the dependencies are installed, download and compile the source code:
- 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 - Build the binary using the provided makefile:
make -f makefile - Install the compiled binary into your system path:
sudo install -v -m755 unrar /usr/local/bin