Compiling rizin and r2ghidra

If you are looking to set up a powerful reverse engineering environment on Linux, combining Rizin with the rz-ghidra decompiler plugin is a great choice. While package managers often carry these tools, building from source ensures you have the latest features and fixes.

We will set up a clean installation using a local prefix (in ~/opt) to keep your system directories clean.

Why Build from Source?

At the time of writing, the dev branch is often preferred over stable for Rizin and its plugins due to rapid development and occasional compilation issues with stable releases. This guide follows the dev branch for both projects to ensure compatibility.

Prepare the Directory Structure

To keep things organized and avoid polluting /usr, we will install everything into a local directory structure under your home folder.

We aim for this layout:

~/opt/rizin
├── install      # Where binaries and libs will live
├── rizin        # Source code for rizin
└── rz-ghidra    # Source code for the plugin

Build and Install Rizin

First, let’s clone and configure the main Rizin project.

mkdir -p ~/opt/rizin
cd ~/opt/rizin

# Clone the repository
git clone https://github.com/rizinorg/rizin

# Configure the build system (Meson)
# We set the prefix to our local install directory
meson --buildtype=release --prefix=~/opt/rizin/install build

Once configured, compile and install:

# Compile using ninja (adjust -j12 to your core count)
ninja -j12 -C build

# Install to /path/for/installation
ninja -C build install

Build and Install rz-ghidra

Now that Rizin is installed, we can build the Ghidra decompiler plugin. It is important that the plugin branch matches the Rizin branch (dev follows dev).

cd ~/opt/rizin

# Clone the plugin repository
git clone https://github.com/rizinorg/rz-ghidra.git
cd rz-ghidra

# Initialize submodules (essential for rz-ghidra)
git submodule init
git submodule update

# Create build directory
mkdir build && cd build

# Configure CMake
# We must point CMake to our custom Rizin installation
cmake -DCMAKE_INSTALL_PREFIX=~/opt/rizin/install -DCMAKE_PREFIX_PATH=~/opt/rizin/install ..

# Compile and install
make -j12
make install

Verification

Let’s verify that everything is working correctly. We can run Rizin directly from our installation path against a standard binary like /bin/ls.

~/opt/rizin/install/bin/rizin /bin/ls

Inside the Rizin shell, you can run the following commands to analyze the binary and test the decompiler:

  • aaa - Analyze the binary.
  • aflt - List functions.
  • pdg @ main - Decompile the main function.

If you see C-like pseudocode, congratulations! You have successfully set up Rizin with the Ghidra decompiler.