Skip to content

Commit 2ff9411

Browse files
committed
make static linking io_uring independent from static feature
Signed-off-by: June Strawberry <june@vern.cc>
1 parent 31e6f8d commit 2ff9411

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ default = [
3232
]
3333
jemalloc = ["rust-librocksdb-sys/jemalloc"]
3434
io-uring = ["rust-librocksdb-sys/io-uring"]
35+
io-uring-static = ["rust-librocksdb-sys/io-uring-static"]
3536
numa = ["rust-librocksdb-sys/numa"]
3637
valgrind = []
3738
snappy = ["rust-librocksdb-sys/snappy"]

librocksdb-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ bindgen-runtime = ["bindgen/runtime"]
3535
bindgen-static = ["bindgen/static"]
3636
mt_static = []
3737
io-uring = ["pkg-config"]
38+
io-uring-static = []
3839
numa = ["pkg-config"]
3940
snappy = []
4041
lz4 = ["lz4-sys"]

librocksdb-sys/build.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,22 @@ fn build_rocksdb() {
304304

305305
#[cfg(feature = "io-uring")]
306306
if target.contains("linux") {
307-
pkg_config::probe_library("liburing")
308-
.expect("The io-uring feature was requested but the library is not available");
307+
// probe_library() only looks for shared objects, so this is misleading when statically
308+
// linking
309+
if cfg!(not(feature = "io-uring-static")) {
310+
pkg_config::probe_library("liburing")
311+
.expect("The io-uring feature was requested but the library is not available");
312+
}
313+
309314
config.define("ROCKSDB_IOURING_PRESENT", Some("1"));
310315

311-
let mode = if cfg!(feature = "static") {
316+
let mode = if cfg!(feature = "io-uring-static") {
312317
"=static"
313318
} else {
314319
""
315320
};
316-
if cfg!(feature = "static") {
321+
322+
if cfg!(feature = "io-uring-static") {
317323
// centos uses its /usr/lib64 search path but liburing.a is installed
318324
// by dnf oddly in /usr/lib unlike other installed archives.
319325
println!("cargo:rustc-link-search=native=/usr/lib");

0 commit comments

Comments
 (0)