Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ members = [
"crates/ntx-builder",
"crates/proto",
"crates/remote-prover-client",
"crates/rocksdb-cxx-linkage-fix",
"crates/rpc",
"crates/store",
"crates/test-macro",
Expand Down Expand Up @@ -47,6 +48,9 @@ miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "0.14" }
miden-node-validator = { path = "crates/validator", version = "0.14" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "0.14" }
# Temporary workaround until <https://github.com/rust-rocksdb/rust-rocksdb/pull/1029>
# is part of `rocksdb-rust` release
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "0.14" }

# miden-base aka protocol dependencies. These should be updated in sync.
miden-block-prover = { branch = "next", git = "https://github.com/0xMiden/miden-base" }
Expand Down
3 changes: 3 additions & 0 deletions bin/network-monitor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ tokio = { features = ["full"], workspace = true }
tonic = { features = ["codegen", "tls-native-roots", "transport"], workspace = true }
tracing = { workspace = true }
url = { features = ["serde"], workspace = true }

[build-dependencies]
miden-node-rocksdb-cxx-linkage-fix = { workspace = true }
3 changes: 3 additions & 0 deletions bin/network-monitor/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
miden_node_rocksdb_cxx_linkage_fix::configure();
}
3 changes: 3 additions & 0 deletions bin/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ miden-protocol = { workspace = true }
tokio = { features = ["macros", "net", "rt-multi-thread"], workspace = true }
url = { workspace = true }

[build-dependencies]
miden-node-rocksdb-cxx-linkage-fix = { workspace = true }

[dev-dependencies]
figment = { features = ["env", "test", "toml"], version = "0.10" }
miden-node-utils = { features = ["tracing-forest"], workspace = true }
3 changes: 3 additions & 0 deletions bin/node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
miden_node_rocksdb_cxx_linkage_fix::configure();
}
7 changes: 4 additions & 3 deletions bin/remote-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ miden-testing = { workspace = true }
miden-tx = { features = ["testing"], workspace = true }

[build-dependencies]
miden-node-proto-build = { features = ["internal"], workspace = true }
miette = { features = ["fancy"], version = "7.5" }
tonic-prost-build = { workspace = true }
miden-node-proto-build = { features = ["internal"], workspace = true }
miden-node-rocksdb-cxx-linkage-fix = { workspace = true }
miette = { features = ["fancy"], version = "7.5" }
tonic-prost-build = { workspace = true }
3 changes: 2 additions & 1 deletion bin/remote-prover/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const GENERATED_OUT_DIR: &str = "src/generated";

/// Generates Rust protobuf bindings.
fn main() -> miette::Result<()> {
println!("cargo::rerun-if-env-changed=BUILD_PROTO");
miden_node_rocksdb_cxx_linkage_fix::configure();
println!("cargo:rerun-if-env-changed=BUILD_PROTO");
if !BUILD_GENERATED_FILES_IN_SRC {
return Ok(());
}
Expand Down
3 changes: 3 additions & 0 deletions bin/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ rayon = { version = "1.10" }
tokio = { workspace = true }
tonic = { default-features = true, workspace = true }
url = { workspace = true }

[build-dependencies]
miden-node-rocksdb-cxx-linkage-fix = { workspace = true }
3 changes: 3 additions & 0 deletions bin/stress-test/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
miden_node_rocksdb_cxx_linkage_fix::configure();
}
19 changes: 19 additions & 0 deletions crates/rocksdb-cxx-linkage-fix/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
authors.workspace = true
description = "Miden C++ stdlib link helper"
edition.workspace = true
homepage.workspace = true
license.workspace = true
name = "miden-node-rocksdb-cxx-linkage-fix"
readme.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[lib]
path = "src/lib.rs"

[lints]
workspace = true

[dependencies]
36 changes: 36 additions & 0 deletions crates/rocksdb-cxx-linkage-fix/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//! A temporary solution to missing c++ std library linkage when using a precompile static library
//!
//! For more information see: <https://github.com/rust-rocksdb/rust-rocksdb/pull/1029>

use std::env;

pub fn configure() {
println!("cargo:rerun-if-env-changed=ROCKSDB_COMPILE");
println!("cargo:rerun-if-env-changed=ROCKSDB_STATIC");
println!("cargo:rerun-if-env-changed=CXXSTDLIB");
let target = env::var("TARGET").unwrap_or_default();
if should_link_cpp_stdlib() {
link_cpp_stdlib(&target);
}
}

fn should_link_cpp_stdlib() -> bool {
let rocksdb_compile = env::var("ROCKSDB_COMPILE").unwrap_or_default();
let rocksdb_compile_disabled = matches!(rocksdb_compile.as_str(), "0" | "false" | "FALSE");
let rocksdb_static = env::var("ROCKSDB_STATIC").is_ok();

rocksdb_compile_disabled && rocksdb_static
}

fn link_cpp_stdlib(target: &str) {
if let Ok(stdlib) = env::var("CXXSTDLIB") {
println!("cargo:rustc-link-lib=dylib={stdlib}");
} else if target.contains("apple") || target.contains("freebsd") || target.contains("openbsd") {
println!("cargo:rustc-link-lib=dylib=c++");
} else if target.contains("linux") {
println!("cargo:rustc-link-lib=dylib=stdc++");
} else if target.contains("aix") {
println!("cargo:rustc-link-lib=dylib=c++");
println!("cargo:rustc-link-lib=dylib=c++abi");
}
}
33 changes: 17 additions & 16 deletions crates/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ version.workspace = true
workspace = true

[dependencies]
anyhow = { workspace = true }
deadpool = { default-features = false, features = ["managed", "rt_tokio_1"], version = "0.12" }
deadpool-diesel = { features = ["sqlite"], version = "0.6" }
deadpool-sync = { default-features = false, features = ["tracing"], version = "0.1" }
diesel = { features = ["numeric", "sqlite"], version = "2.3" }
diesel_migrations = { features = ["sqlite"], version = "2.3" }
fs-err = { workspace = true }
hex = { version = "0.4" }
indexmap = { workspace = true }
miden-crypto = { features = ["concurrent", "hashmaps"], workspace = true }
miden-node-proto = { workspace = true }
miden-node-proto-build = { features = ["internal"], workspace = true }
miden-node-utils = { workspace = true }
miden-standards = { workspace = true }
anyhow = { workspace = true }
deadpool = { default-features = false, features = ["managed", "rt_tokio_1"], version = "0.12" }
deadpool-diesel = { features = ["sqlite"], version = "0.6" }
deadpool-sync = { default-features = false, features = ["tracing"], version = "0.1" }
diesel = { features = ["numeric", "sqlite"], version = "2.3" }
diesel_migrations = { features = ["sqlite"], version = "2.3" }
fs-err = { workspace = true }
hex = { version = "0.4" }
indexmap = { workspace = true }
miden-crypto = { features = ["concurrent", "hashmaps"], workspace = true }
miden-node-proto = { workspace = true }
miden-node-proto-build = { features = ["internal"], workspace = true }
miden-node-rocksdb-cxx-linkage-fix = { optional = true, workspace = true }
miden-node-utils = { workspace = true }
miden-standards = { workspace = true }
# TODO remove `testing` from `miden-protocol`, required for `BlockProof::new_dummy`
miden-protocol = { features = ["std", "testing"], workspace = true }
pretty_assertions = { workspace = true }
Expand Down Expand Up @@ -58,7 +59,7 @@ termtree = { version = "0.5" }

[features]
default = ["rocksdb"]
rocksdb = ["miden-crypto/rocksdb"]
rocksdb = ["miden-crypto/rocksdb", "miden-node-rocksdb-cxx-linkage-fix"]

[[bench]]
harness = false
Expand All @@ -69,4 +70,4 @@ required-features = ["rocksdb"]
# This is an indirect dependency for which we need to enable optimisations
# via feature flags. Because we don't use it directly in code, machete
# identifies it as unused.
ignored = ["miden-crypto"]
ignored = ["miden-crypto", "miden-node-rocksdb-cxx-linkage-fix"]