Skip to content

Development

In order 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:

sh
$ git clone https://codeberg.org/ReOxide/reoxide
$ cd reoxide

ReOxide consists of the decompiler, which is a drop-in replacement for the Ghidra decompiler, and a manager, who the decompiler instances communicate with. ReOxide uses Meson as build system, as well as Python for the manager component and packaging.

Building using Python

For ease of packaging, ReOxide currently uses the Python build system for manager component and packages the decompiler component directly into the corresponding Python wheel. This is achieved by making use of the meson-python build backend. Using pip, ReOxide can be built and installed into the current Python environment using the following command:

sh
$ pip install . -Cbuild-dir=build

The -Cbuild-dir=build argument tells pip to use a specific build directory for meson, which caches the build artifacts. Subsequent builds will then be faster, as only the needed files will be compiled. Because the build step for the C++ code needs to be performed every time a change is made, using the typical --editable flag for developing Python packages is not useful here and might lead to issues. The Python package build can be used to build a pip wheel that can be installed separately if needed:

sh
$ python -m build -Cbuild-dir=build .

Building ReOxide binaries manually

It can be helpful to build ReOxide manually for development purposes, especially if you intend to write your own plugins later. Building everything currently requires libLLVM and libclang-cpp for parsing all existing actions and the default pipeline from Ghidra, in addition to the cppzmq dependency for decompiler/manager communication. If you have everything installed, you should be able to build it like this:

sh
$ meson setup build -Db_ndebug=true -Dextract-actions=enabled
$ meson compile -C build

Because the custom clang tool can be a bit finnicky, this might not succeed. In this case, the actual extraction of actions from the Ghidra code base can be split into a separate build step.

Extracting actions and default pipeline from Ghidra

As mentioned above, 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:

sh
$ 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. Once the exactions have been extracted, this step does not have to be repeated.

Building ReOxide with existing generated files

If cppzmq is available on the system and the generated folder exists with the relevant files, the ReOxide binaries can be built with the following commands:

sh
$ meson setup build -Db_ndebug=true
$ meson compile -C build

INFO

At this point, you might be wondering why we are setting b_ndebug=true. The b_ndebug=true flag disables the generation of certain assertions, which is sometimes necessary to keep upstream Ghidra working, e.g. out-of-bound reads that do not cause harm, but are not detected in shipped Ghidra builds. These issues need to be fixed upstream and we want to stay as close to upstream as possible, in order to minimize the possible issues caused by the ReOxide code. To build an optimized binary, the following options can be used to include optimizations and debug information at the same time:

sh
$ 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 like this:

sh
# Make sure to backup original decompile file before
$ ln -sr build/decomp/decompile "$GHIDRA_INSTALL_DIR/Ghidra/Features/Decompiler/os/linux_x86_64/decompile"