Skip to content

Commit

Permalink
[core] Fixes required for Sui to build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc authored and bmwill committed Jun 27, 2022
1 parent 0a30a71 commit cfb9d15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ xclippy = [
"-Wclippy::disallowed_methods",
]
xlint = "run --package x --bin x -- lint"

[target.'cfg(target_family = "windows")']
rustflags = [ "-C", "link-args=/STACK:64000000" ]
10 changes: 6 additions & 4 deletions crates/sui-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ pub fn default_db_options(

// One common issue when running tests on Mac is that the default ulimit is too low,
// leading to I/O errors such as "Too many open files". Raising fdlimit to bypass it.
options.set_max_open_files((fdlimit::raise_fd_limit().unwrap() / 8) as i32);
if let Some(limit) = fdlimit::raise_fd_limit() {
// on windows raise_fd_limit return None
options.set_max_open_files((limit / 8) as i32);
}

/* The table cache is locked for updates and this determines the number
of shareds, ie 2^10. Increase in case of lock contentions.
*/
// The table cache is locked for updates and this determines the number
// of shareds, ie 2^10. Increase in case of lock contentions.
let row_cache =
rocksdb::Cache::new_lru_cache(cache_capacity.unwrap_or(300_000)).expect("Cache is ok");
options.set_row_cache(&row_cache);
Expand Down
4 changes: 2 additions & 2 deletions crates/workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ publish = false
# are managed by hakari.

### BEGIN HAKARI SECTION
[dependencies]
[target.'cfg(not(windows))'.dependencies]
addr2line = { version = "0.17", default-features = false }
adler = { version = "1", default-features = false }
ahash = { version = "0.7", features = ["std"] }
Expand Down Expand Up @@ -550,7 +550,7 @@ yaml-rust = { version = "0.4", default-features = false }
zeroize = { version = "1", features = ["alloc", "zeroize_derive"] }
zstd-sys = { version = "1", default-features = false }

[build-dependencies]
[target.'cfg(not(windows))'.build-dependencies]
Inflector = { version = "0.11", default-features = false }
addr2line = { version = "0.17", default-features = false }
adler = { version = "1", default-features = false }
Expand Down

0 comments on commit cfb9d15

Please sign in to comment.