`stalwart` does not build with rocksdb `11.x.x` libraries

Issue Description

I am trying to build stalwart from source using 11.1.2 of rocksdb however it fails to compile and build.

Expected Behavior

Should be able to compile and use rocksdb 11 as backend

Actual Behavior

stalwart fails to compile with rocksdb 11 libraries

Reproduction Steps

  1. build rocksdb 11 from source
  2. export ROCKSDB_INCLUDE_DIR=/path/to/rocksdb11/build/include
  3. export ROCKSDB_LIB_DIR=/pathj/to/rocksdb11/build/lib
  4. build stalwart from source (tag: v0.16.11)

Relevant Log Output

...
   Compiling rocksdb v0.24.0
   Compiling virtue v0.0.18
   Compiling decancer v3.3.3
error[E0425]: cannot find function `rocksdb_options_set_skip_checking_sst_file_sizes_on_db_open` in crate `ffi`
    --> /nix/var/nix/builds/nix-47127-4213388205/stalwart-0.16.11-vendor/source-registry-0/rocksdb-0.24.0/src/db_options.rs:2716:18
     |
2716 |             ffi::rocksdb_options_set_skip_checking_sst_file_sizes_on_db_open(
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

   Compiling constant_time_eq v0.3.1
   Compiling prometheus v0.14.0
   Compiling totp-rs v5.7.2
error[E0061]: this function takes 5 arguments but 6 arguments were supplied
  --> /nix/var/nix/builds/nix-47127-4213388205/stalwart-0.16.11-vendor/source-registry-0/rocksdb-0.24.0/src/slice_transform.rs:49:13
   |
49 |             ffi::rocksdb_slicetransform_create(
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
56 |                 Some(slice_transform_name_callback),
   |                 ----------------------------------- unexpected argument #6 of type `Option<unsafe extern "C" fn(*mut c_void) -> *const i8 {slice_transfo_`
   |
note: function defined here
  --> /nix/var/nix/builds/nix-47127-4213388205/source/target/aarch64-apple-darwin/release/build/librocksdb-sys-2aa72d5739d9444c/out/bindings.rs:3:164766
   |
 3 | ...ut libc :: c_char) ; } unsafe extern "C" { pub fn rocksdb_slicetransform_create (state : * mut libc :: c_void , destructor : :: s...
   |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
   |
55 -                 None,
56 -                 Some(slice_transform_name_callback),
55 +                 None,
   |

   Compiling jsonwebtoken v10.4.0
   Compiling bincode_derive v2.0.1
Some errors have detailed explanations: E0061, E0425.
For more information about an error, try `rustc --explain E0061`.

Stalwart Version

v0.16.x

Installation Method

Built from source

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

related: Update Request: rocksdb 10.10.1 → 11.1.2 · Issue #536878 · NixOS/nixpkgs · GitHub

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This is coming from the rocksdb Rust crate (v0.24) that Stalwart depends on, not from Stalwart’s own code. That crate’s FFI bindings were generated against an older librocksdb release, so its function signatures (e.g. rocksdb_slicetransform_create) and expected symbols (e.g. rocksdb_options_set_skip_checking_sst_file_sizes_on_db_open) don’t match RocksDB 11.x’s C API, which is why linking against a self-built RocksDB 11 fails even though Stalwart itself hasn’t changed anything.

Stalwart’s store crate pins rocksdb = "0.24" with the multi-threaded-cf feature, and that crate normally vendors/bundles its own compatible RocksDB version rather than expecting an arbitrary external one supplied via ROCKSDB_INCLUDE_DIR/ROCKSDB_LIB_DIR. Until that crate is bumped to a version whose bindings support RocksDB 11’s API, building against externally-supplied RocksDB 11 libraries won’t work, this is a compatibility gap in the upstream rust-rocksdb bindings rather than a configuration issue you can work around from Stalwart’s side. Building with the bundled RocksDB (i.e. not overriding ROCKSDB_INCLUDE_DIR/ROCKSDB_LIB_DIR) should still work fine.

This isn’t covered in the current docs. A community member or staff member will follow up.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.