aports/community/electrs/update-rust-rocksdb-crate.patch
mio ddd38a967c community/electrs: fix build with rocksdb 11.0.4
Update rust-rocksdb crate to 0.47.0 for compatibility with rocksdb
11.0.4. Also fix a mismatched types error in `src/db.rs`.

```
   Compiling rust-rocksdb v0.36.0
error[E0425]: cannot find function `rocksdb_options_set_skip_checking_sst_file_sizes_on_db_open` in crate `ffi`
    --> /home/buildozer/aports/community/electrs/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rust-rocksdb-0.36.0/src/db_options.rs:2763:18
     |
2763 |             ffi::rocksdb_options_set_skip_checking_sst_file_sizes_on_db_open(
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0061]: this function takes 5 arguments but 6 arguments were supplied
    --> /home/buildozer/aports/community/electrs/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rust-rocksdb-0.36.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 u8 {slice_transform_name_callback}>`
     |
note: function defined here
    --> /home/buildozer/aports/community/electrs/src/electrs-0.11.0/target/release/build/rust-librocksdb-sys-87993afb6e66377d/out/bindings.rs:5277:12
     |
5277 |     pub fn rocksdb_slicetransform_create(
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
     |
  55 -                 None,
  56 -                 Some(slice_transform_name_callback),
  55 +                 None,
     |

Some errors have detailed explanations: E0061, E0425.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `rust-rocksdb` (lib) due to 2 previous errors
```

```
error[E0308]: mismatched types
   --> src/db.rs:309:27
    |
309 |         self.db.write_opt(db_batch, &opts).unwrap();
    |                 --------- ^^^^^^^^ expected `&WriteBatchWithTransaction<false>`, found `WriteBatchWithTransaction<false>`
    |                 |
    |                 arguments to this method are incorrect
    |
    = note: expected reference `&WriteBatchWithTransaction<_>`
                  found struct `WriteBatchWithTransaction<_>`
note: method defined here
   --> [...]/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rust-rocksdb-0.47.0/src/db.rs:988:12
    |
988 |     pub fn write_opt(&self, batch: &WriteBatch, writeopts: &WriteOptions) -> Result<(), Error> {
    |            ^^^^^^^^^
help: consider borrowing here
    |
309 |         self.db.write_opt(&db_batch, &opts).unwrap();
    |                           +

For more information about this error, try `rustc --explain E0308`.
warning: `electrs` (lib) generated 2 warnings
error: could not compile `electrs` (lib) due to 1 previous error; 2 warnings emitted
```
2026-04-13 04:49:40 +00:00

85 lines
2.5 KiB
Diff

diff -rupN a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock 2025-11-15 19:49:18.000000000 +0000
+++ b/Cargo.lock 2026-04-13 04:26:51.750000000 +0000
@@ -59,16 +59,14 @@ checksum = "d965446196e3b7decd44aa7ee49e
[[package]]
name = "bindgen"
-version = "0.69.5"
+version = "0.72.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
+checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"itertools",
- "lazy_static",
- "lazycell",
"proc-macro2",
"quote",
"regex",
@@ -592,12 +590,6 @@ source = "registry+https://github.com/ru
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
-name = "lazycell"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
-
-[[package]]
name = "libc"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -940,9 +932,9 @@ checksum = "2b15c43186be67a4fd63bee50d03
[[package]]
name = "rust-librocksdb-sys"
-version = "0.32.0+9.10.0"
+version = "0.43.0+11.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50146b7fadd68926e9dcb902bf0515783aaaf5f73af26949f188aead5ede8cd0"
+checksum = "451f844a0bccbb44219d292c8d85d87f1e07717aa81bd2cc07a3e5d66fef61e7"
dependencies = [
"bindgen",
"bzip2-sys",
@@ -955,19 +947,20 @@ dependencies = [
[[package]]
name = "rust-rocksdb"
-version = "0.36.0"
+version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bf088a714aa3fad699f7dbe06047ca732c09629a2f9b28aa16ca6d3897a4c2f"
+checksum = "d7d9dbd1221eadae2ae781a7553a3c61afeb0816d7d3cf04371fa3ddce50dbf0"
dependencies = [
"libc",
+ "parking_lot",
"rust-librocksdb-sys",
]
[[package]]
name = "rustc-hash"
-version = "1.1.0"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
[[package]]
name = "rustix"
diff -rupN a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml 2025-11-15 19:49:18.000000000 +0000
+++ b/Cargo.toml 2026-04-13 04:26:49.360000000 +0000
@@ -46,7 +46,7 @@ ctrlc = "=3.5.0"
signal-hook = "0.3"
[dependencies.rust-rocksdb]
-version = "0.36"
+version = "0.47"
default-features = false
# ZSTD is used for data compression