#+TITLE: Zig-rocksdb #+DATE: 2024-04-27T11:27:04+0800 #+LASTMOD: 2024-10-27T14:34:21+0800 #+AUTHOR: Jiacai Liu
[[https://img.shields.io/badge/zig%20version-0.13.0-blue.svg]] [[https://github.com/jiacai2050/zig-rocksdb/actions/workflows/CI.yml][https://github.com/jiacai2050/zig-rocksdb/actions/workflows/CI.yml/badge.svg]]
[[https://github.com/facebook/rocksdb/][RocksDB]] binding for Zig.
Replace ${COMMIT} with a real one, then in your =build.zig=, import the module like this:
#+begin_src zig
const dep_rocksdb = b.dependency(“rocksdb”, .{});
exe.root_module.addImport(“rocksdb”, dep_rocksdb.module(“rocksdb”));
exe.linkLibC();
#+end_src
This library will link to a vendored [[https://github.com/facebook/rocksdb/releases/tag/v9.0.0][librocksdb(v9.0.0)]] by default, you can disable it and link to system-wide with this #+begin_src zig const dep_rocksdb = b.dependency(“rocksdb”, .{ .link_vendor = false }); exe.linkSystemLibrary(“rocksdb”); exe.linkLibC(); #+end_src
Acknowledge Thanks to [[https://github.com/rust-rocksdb/rust-rocksdb][rust-rocksdb]], I benefit a lot from it when build this building library.
License [[file:LICENSE][MIT]]