Building Rerius
Repository: https://github.com/ECLS-Studio/rerius
Requirements#
| Component | Minimum |
|---|---|
| C compiler | GCC >= 7 or Clang >= 6 |
| Build system | GNU make (or gmake on BSD) |
| External libraries | None |
| JS addon / npm | Node.js >= 16 with dev headers |
Linux (Debian / Ubuntu)#
sudo apt install build-essential nodejs libnode-dev
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
Linux (Fedora / RHEL)#
sudo dnf install gcc make nodejs nodejs-devel
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
Linux (Arch)#
sudo pacman -S base-devel nodejs
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
Android / Termux#
pkg update && pkg install nodejs clang make git
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
macOS#
xcode-select --install # if not already installed
brew install node # or download from nodejs.org
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
Rerius uses platform/arm64_macos.S (Mach-O syntax) on Apple Silicon and platform/x86_64_macos.S on Intel Mac: both are selected automatically by the Makefile. macOS Mach-O binaries, including universal/FAT binaries, are fully supported.
FreeBSD / OpenBSD#
# FreeBSD
pkg install gmake node
# OpenBSD
pkg_add node
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && gmake
Windows (MSYS2 / MinGW)#
# In MSYS2 terminal
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make
git clone https://github.com/ECLS-Studio/rerius.git
cd Rerius && make
# Produces rerius.exe
Makefile Targets#
| Target | Description |
|---|---|
make (default) |
Runs setup.sh, an interactive menu: Code compiles the CLI + JS addon, JS builds only the JS addon, Learn opens the lesson browser |
make clean |
Remove object files and built binaries (rerius, rerius.exe, js/rerius.node) |
make install |
Prints a reminder to run setup.sh first, then copy rerius to your PATH manually: there is no separate install step that does this for you |
Building the JS Addon#
make builds both the CLI and the JS addon automatically. To build the addon separately:
make
# or
bash build_js.sh
# or (from inside js/)
npm run build
build_js.sh auto-detects the platform, compiler, Node.js headers, and applies the correct linker flags per platform.
Manual compile#
The build script (build_js.sh) also adds a platform-specific .S stub from platform/ (skip it if you don't need the raw-syscall entry point). The full C source list, matching LIB_SRCS in build_js.sh:
NODE_INC=$(node -p "require('path').join(process.execPath,'../../include/node')")
clang -shared -fPIC -O2 -std=c99 -D_GNU_SOURCE \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 \
-I./include -I"$NODE_INC" \
js/src/rerius_napi.c \
src/cli/main.c src/cli/interactive.c \
src/core/loader.c src/core/config.c src/core/plugin.c src/core/daxc.c src/core/hardening.c \
src/formats/macho.c \
src/arch/disasm.c src/arch/x86_decode.c src/arch/arm64_decode.c src/arch/riscv_decode.c \
src/analysis/analysis.c src/analysis/cfg.c src/analysis/callgraph.c src/analysis/loops.c \
src/analysis/symexec.c src/analysis/decomp.c src/analysis/correct.c src/analysis/dsa.c src/analysis/entropy.c \
src/emu/emulate.c \
src/util/sha256.c src/util/unicode.c src/util/demangle.c src/util/symbols.c \
-Wl,--unresolved-symbols=ignore-all -lm \
-o js/rerius.node
If any source file is left out of this list, the addon will still link (--unresolved-symbols=ignore-all suppresses the error) but will crash at runtime the first time a function from the missing file is called, so prefer build_js.sh over hand-maintaining this list.
Compiler Flags Explained#
| Flag | Reason |
|---|---|
-std=c99 |
Strict C99: no GNU extensions; works on Clang 21+ |
-O2 |
Optimise for speed |
-I./include |
Required for dax.h, dax_guard.h, architecture headers |
-D_GNU_SOURCE |
Enable open_memstream and memmem |
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
Disable glibc buffer wrappers that reject valid N-API patterns |
-lm |
Math library: required for log2() in the entropy module |
The -I./include flag picks up dax_guard.h: the microkernel fault isolation header introduced in v1.0.0. All source files include this header and it must be visible to the compiler. The flag is already present in setup.sh's BASE_CFLAGS.
Verification#
./rerius -h # print help
./rerius /bin/ls # basic disassembly
./rerius -x /bin/ls # full standard analysis
./rerius -X /bin/ls < /dev/null # full analysis including all advanced modules (-X also enables the interactive shell -- see docs/CLI_REFERENCE.md)
node js/test/basic.js # 27 tests: all should pass
Troubleshooting#
dax_guard.h not found:
# Ensure -I./include is in CFLAGS. setup.sh adds this automatically.
grep "Iinclude\|I./include" setup.sh # should match BASE_CFLAGS line
If building manually, add -I./include to your compile command.
isprint undeclared (Clang strict C99):
<ctype.h> and <stdbool.h> are explicitly included in js/src/rerius_napi.c in the current source. If you hit this, make sure you're building from the latest tagged release rather than an older checkout.
log2 undefined / linker error:
grep LDFLAGS setup.sh # should include -lm
node_api.h not found:
# Check where Node.js headers are installed
node -p "require('path').join(process.execPath,'../../include/node')"
# On Debian/Ubuntu: sudo apt install libnode-dev
--unresolved-symbols=ignore-all not supported (some LLD versions):
build_js.sh detects this and falls back automatically. On macOS, -undefined dynamic_lookup is used instead.
open_memstream not available:
Requires Linux glibc >= 2.10 or macOS >= 10.13. On older systems, upgrade the OS or use Termux.
npm Install (No Git Clone Required)#
npm install rerius
The postinstall script compiles the native addon automatically:
- Checks for a prebuilt binary in
js/prebuilds/rerius-<platform>-<arch>.node: copies it if found. - Falls back to running
build_js.sh. - Falls back to an inline
clang/gcccompile using the detected Node.js headers.
const rerius = require('rerius');
rerius.withBinary('/bin/ls', bin => console.log(bin.arch));
See NPM_USAGE.md for full examples.
docs/BUILDING.md · Rerius v1.0.0