Rizin
unix-like reverse engineering framework and cli tools
|
The first time you download Rizin you can use:
After that, use git pull
to update the Rizin codebase.
Rizin uses meson
to build. As not all systems have a version of meson
that is recent enough, we suggest to install it directly from pip
with pip install meson
. If necessary, also install ninja
with pip install ninja
.
If you are trying to build Rizin to create a package for a distribution, take a look at doc/PACKAGERS.md.
Unless you are interested in debugging Rizin, it is a good idea to pass the --buildtype=release
flag to meson
for increased performance and to prevent the buggy mspdbsrv.exe
process from blocking/breaking the building process when generating PDB
files in Windows. See the first table in the Running Meson Documentation for other build types.
/usr/local
This is the default configuration and it allows you to install your built Rizin version while keeping, if provided, the Rizin version shipped by your distribution in /usr
.
NOTE: when --prefix=/usr
is not used, meson will set RPATH
to ensure that libraries can be found on the system without having to deal with LD_LIBRARY_PATH
or ld settings. This is done to ensure a simple installation process out-of-the-box, but if you don't want this behaviour and you know what you are doing, you can still use -Dlocal=disabled
to avoid using RPATH
.
/usr
If your system does not already provide rizin in /usr/bin
, you want to package Rizin on your preferred distribution or you just prefer to have Rizin together with all other binaries on your system, you can also install it system-wide in /usr
.
This kind of installation is not recommended if your system provides Rizin as a package or if you don't want to mess with software provided by your distribution.
~/.local
You are not forced to install Rizin in your system, you can just make it available for your current user, without requiring you to have sudo
access to the machine (or if you don't trust our build scripts enough).
The install
step will install rizin in ~/.local/bin
, so make sure to add it to your PATH
variable (e.g. export PATH=$PATH:~/.local/bin
).
NOTE: meson will set RPATH
to ensure that libraries can be found on the system without having to deal with LD_LIBRARY_PATH
or ld settings. This is done to ensure a simple installation process out-of-the-box, but if you don't want this behaviour and you know what you are doing, you can still use -Dlocal=disabled
to avoid using RPATH
.
The building steps on Windows are the same as on *NIX systems, however you will have to run the following commands from the Visual Studio Developer shell (search for "x64 Native Tools Command Prompt for VS 2019" or similar). To install Meson on Windows, follow instructions here. If using PowerShell, replace CD%
with $((Get-Item .).FullName)
You can run rizin from .\rizin-install\bin
. If you don't specify any --prefix
, meson will install rizin directly under C:\
.
Use -Db_sanitize=address,undefined
during the setup phase.
It may be useful to run Rizin just by using a single file, which can be copied on other systems if necessary. On *NIX systems, this adds the classic -static
flag to the linker, while on Windows it uses /MT
.
You can cross-compile rizin from your main machine to target your Android device. First download and install the Android NDK from https://developer.android.com/ndk.
Then you can use meson to cross-compile, however you have to provide a configuration file that specifies all the necessary information meson needs to know to correctly cross-compile.
You can find an example of such a file in our codebase, but you should adjust it to match your system.
To make the deployment and usage of the rizin tools easier from within your Android device, we suggest to compile statically and by using the blob feature, which will produce just one executable and link all the other tools to that only tool, similar to how busybox works.
At this point you can find everything under /tmp/android-dir
and you can copy files to your Android device.
Whenever you want to build Rizin for a different system/architecture than the one you are using for building, you are effectively cross-compiling and you should provide a full configuration file to tell meson what is the target machine.
Even to compile a 32-bit version of Rizin on a 64-bit machine, you should use a configuration file like the following:
Alternatively, if your distribution provide specific compiler tools for the i686 architecture, you can use a configuration similar to this:
Of course, you might have to adjust some settings depending on your system and you should double check that you have installed all the necessary 32-bit libraries and tools. Once you have checked everything, you can setup the build directory with:
If Rizin was installed using meson
, you can run the following command from the same build directory where you had previously installed Rizin:
$ ninja -C build # or meson compile -C build
$ sudo ninja -C build install # or sudo meson install -C build
. sudo
may not be required based on how you configured the build
directory with meson the first time ```
If you are a developer, it might not be necessary to run the install
step (the second step from above) every time you build Rizin. You can directly use rizin
from ./build/binrz/rizin/rizin.
If you encounter issues while re-building Rizin, try to remove the existing build directory (e.g. rm -r ./build
) and clean the subproject files downloaded by meson (e.g. git clean -dxff subprojects/
). Note that changing a meson.build
file does not guarantee a full rebuild.