Build and use RocksDB in zig.
rocksdb-zig
is pinned to Zig 0.13
, so you will need to have it installed.
Supported use cases:
- ⬇️ Build a RocksDB static library using the zig build system.
- ⬇️ Use the RocksDB C API through auto-generated Zig bindings.
- ⬇️ Import an idiomatic zig library of bindings that wrap the RocksDB library with hand-written zig code.
Clone this repository, then run zig build
.
You will find a statically linked rocksdb
archive
in zig-out/lib/librocksdb.a
.
You can use this with any language or build system.
Fetch rocksdb
and save it to your build.zig.zon
:
$ zig fetch --save=rocksdb https://github.com/Syndica/rocksdb-zig/archive/<COMMIT_HASH>.tar.gz
Add the import to a module:
const rocksdb = b.dependency("rocksdb", .{}).module("rocksdb");
exe.root_module.addImport("rocksdb", rocksdb);
Import the rocksdb
module.
const rocksdb = @import("rocksdb");
Fetch rocksdb
and save it to your build.zig.zon
:
$ zig fetch --save=rocksdb https://github.com/Syndica/rocksdb-zig/archive/<COMMIT_HASH>.tar.gz
Add the import to a module:
const rocksdb_bindings = b.dependency("rocksdb", .{}).module("rocksdb-bindings");
exe.root_module.addImport("rocksdb-bindings", rocksdb_bindings);
Import the rocksdb-bindings
module.
const rocksdb = @import("rocksdb-bindings");