Development
To work on ReOxide directly or develop plugins for the decompiler, you need to familiarize yourself with the project structure and the build system. For starters, clone the ReOxide source repository:
$ git clone https://codeberg.org/ReOxide/reoxide
$ cd reoxide
ReOxide consists of the decompiler, a drop-in replacement for the Ghidra decompiler, and a manager, who the decompiler instances communicate with. ReOxide uses Meson as build system and Python for the manager part and packaging.
Building using Python
ReOxide currently uses the Python build
system for the manager part and packages the decompiler part directly into the Python wheel, using the meson-python backend. To build and install ReOxide into the current Python environment, use pip
:
$ pip install . -Cbuild-dir=build
The -Cbuild-dir=build
argument tells pip
to use a specific build directory for meson
, caching the build artifacts and improving build times. The meson
setup currently does not support the --editable
flag when installing with pip
. While possible in theory, see the relevant documentation page, the path structure of ReOxide does not allow it. The Python package build
produces an installable pip
wheel if needed:
$ python -m build -Cbuild-dir=build .
Building ReOxide binaries manually
Building ReOxide manually helps for development purposes and writing your own plugins later. Building everything currently requires libLLVM
and libclang-cpp
for parsing all existing actions, the default pipeline from Ghidra and the cppzmq
dependency for decompiler/manager communication. If you have everything installed, the following commands build the project:
$ meson setup build -Db_ndebug=true -Dextract-actions=enabled
$ meson compile -C build
Because the custom clang
tool depends on clang
version 19, this might not succeed. In this case, the project allows splitting the extraction of actions from the Ghidra into a separate build step.
Extracting actions and default pipeline from Ghidra
As mentioned earlier, this requires libLLVM
and libclang-cpp
with clang
version 19. You can skip this step entirely if you use the generated
artifact from the build-wheels.yml
workflow of the ReOxide CI builds. If you take this artifact, you just need to extract it into a folder called generated
in the repository root folder and can then skip this step. If you want to extract the actions yourself, you can do so with the following meson options:
$ meson setup build -Dextract-actions=enabled -Dextract-only=enabled
$ meson compile -C build
$ ./scripts/copy-generated.sh build
This will only build the Ghidra dependencies, extract the actions and with the last line copy it to the generated
folder. A Ghidra version changes requires extracting the actions again.
Building ReOxide with existing generated files
With cppzmq
installed and the generated
folder existing, the following commands build the ReOxide binaries:
$ meson setup build -Db_ndebug=true
$ meson compile -C build
INFO
The b_ndebug=true
flag disables the generation of certain assertions to keep upstream Ghidra working. For example, out-of-bound reads that do not cause harm sometimes ship with Ghidra releases and trigger assertions if enabled. These issues need upstream fixes and we want to stay as close to upstream as possible. To build an optimized binary, the following options can allow including optimizations and debug information at the same time:
$ meson setup -Db_ndebug=true -Ddebug=true -Doptimization=3 build
$ meson compile -C build
If you want to improve the development experience, you can directly link the ReOxide decompile
binary to your Ghidra installation:
# Make sure to backup original decompile file before
$ ln -sr build/decomp/decompile "$GHIDRA_INSTALL_DIR/Ghidra/Features/Decompiler/os/linux_x86_64/decompile"
Building ReOxide and installing into a Python virtual environment
Instead of using pip
to install ReOxide into a Python environment, meson
can do this directly. The meson
build needs awareness of the virtual environment for this:
$ meson setup build -Db_ndebug=true -Dpython.install_env=venv
This should automatically take your current Python virtual environment and install ReOxide into it. But it can also result in the following error:
ERROR: python.install_env cannot be set to "venv" unless you are in a venv!
To fix this, the path to the Python binary of the virtual environment needs explicit specification, using a meson
native file. This file can contain paths and options for the current build machine. Setting the path to a python binary can look like this:
[binaries]
python = '/home/user/venv/bin/python'
If we save this, for example, in a file called python-env.ini
, we can then call meson
with another parameter and should not receive the error message again:
$ meson setup build -Db_ndebug=true -Dpython.install_env=venv --native-file python-env.ini