Skip to content

Instantly share code, notes, and snippets.

@rahogata
Last active July 3, 2025 15:17
Show Gist options
  • Save rahogata/980879fd539279a777454042e83d653e to your computer and use it in GitHub Desktop.
Save rahogata/980879fd539279a777454042e83d653e to your computer and use it in GitHub Desktop.
Build redisjson module in freebsd 13

Install build dependencies

  • LLVM : 20+
  • Rust : latest
pkg install -y curl bash devel/llvm-devel

curl https://sh.rustup.rs -sSf > rustup.sh

bash rustup.sh -y

. $HOME/.cargo/env

Clone a specific release

git clone --recursive --branch v2.6.11 --depth 1 https://github.com/RedisJSON/RedisJSON.git

Enter project directory

cd RedisJSON

Disable debug mode to reduce size of .so

Edit Cargo.toml and change debug = 1 to debug = 0 as shown below.

[profile.release]
debug = 0

Fix Linkme Section Linking on FreeBSD with Rust Flags

Add below snippet in .cargo/config.toml

[target.x86_64-unknown-freebsd]
rustflags = [
  "-C", "link-arg=-Wl,-z,nostart-stop-gc"
]

Build

cargo build --release

Usage

Use binary generated in target/release/librejson.so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment