diff --git a/Cargo.toml b/Cargo.toml index da65de1..f7d7de6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ default = [ ] jemalloc = ["rust-librocksdb-sys/jemalloc"] io-uring = ["rust-librocksdb-sys/io-uring"] +io-uring-static = ["rust-librocksdb-sys/io-uring-static"] numa = ["rust-librocksdb-sys/numa"] valgrind = [] snappy = ["rust-librocksdb-sys/snappy"] diff --git a/librocksdb-sys/Cargo.toml b/librocksdb-sys/Cargo.toml index 69f0463..c1ecafc 100644 --- a/librocksdb-sys/Cargo.toml +++ b/librocksdb-sys/Cargo.toml @@ -35,6 +35,7 @@ bindgen-runtime = ["bindgen/runtime"] bindgen-static = ["bindgen/static"] mt_static = [] io-uring = ["pkg-config"] +io-uring-static = [] numa = ["pkg-config"] snappy = [] lz4 = ["lz4-sys"] diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index 708a087..fdab6d8 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -304,16 +304,22 @@ fn build_rocksdb() { #[cfg(feature = "io-uring")] if target.contains("linux") { - pkg_config::probe_library("liburing") - .expect("The io-uring feature was requested but the library is not available"); + // probe_library() only looks for shared objects, so this is misleading when statically + // linking + if cfg!(not(feature = "io-uring-static")) { + pkg_config::probe_library("liburing") + .expect("The io-uring feature was requested but the library is not available"); + } + config.define("ROCKSDB_IOURING_PRESENT", Some("1")); - let mode = if cfg!(feature = "static") { + let mode = if cfg!(feature = "io-uring-static") { "=static" } else { "" }; - if cfg!(feature = "static") { + + if cfg!(feature = "io-uring-static") { // centos uses its /usr/lib64 search path but liburing.a is installed // by dnf oddly in /usr/lib unlike other installed archives. println!("cargo:rustc-link-search=native=/usr/lib");