Skip to content

Commit b7be57f

Browse files
authored
Merge pull request #2735 from input-output-hk/jpraynaud/fix-rug-static-compilation
fix: do not build `rug` when targeting `musl` env
2 parents d671644 + 9ce17df commit b7be57f

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-stm/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.5.5 (10-13-2025)
9+
10+
### Fixed
11+
12+
- Fixed compilation issues with `rug` when targeting `musl` environment.
13+
814
## 0.5.4 (10-07-2025)
915

1016
### Added

mithril-stm/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-stm"
3-
version = "0.5.4"
3+
version = "0.5.5"
44
edition = { workspace = true }
55
authors = { workspace = true }
66
homepage = { workspace = true }
@@ -30,13 +30,13 @@ rayon = { workspace = true }
3030
serde = { workspace = true }
3131
thiserror = { workspace = true }
3232

33-
[target.'cfg(any(target_family = "wasm", windows))'.dependencies]
33+
[target.'cfg(any(target_family = "wasm", target_env = "musl", windows))'.dependencies]
3434
# WASM and Windows don't support rug backend, fallback to num-integer only
3535
num-bigint = { version = "0.4.6" }
3636
num-rational = { version = "0.4.2" }
3737
num-traits = { version = "0.2.19" }
3838

39-
[target.'cfg(not(any(target_family = "wasm", windows)))'.dependencies]
39+
[target.'cfg(not(any(target_family = "wasm", target_env = "musl", windows)))'.dependencies]
4040
num-bigint = { version = "0.4.6", optional = true }
4141
num-rational = { version = "0.4.2", optional = true }
4242
num-traits = { version = "0.2.19", optional = true }

mithril-stm/src/eligibility_check.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ use {
77
std::ops::Neg,
88
};
99

10-
#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))]
10+
#[cfg(any(
11+
feature = "num-integer-backend",
12+
target_family = "wasm",
13+
target_env = "musl",
14+
windows
15+
))]
1116
/// Checks that ev is successful in the lottery. In particular, it compares the output of `phi`
1217
/// (a real) to the output of `ev` (a hash). It uses the same technique used in the
1318
/// [Cardano ledger](https://github.com/input-output-hk/cardano-ledger/). In particular,
@@ -49,7 +54,12 @@ pub(crate) fn is_lottery_won(phi_f: f64, ev: [u8; 64], stake: Stake, total_stake
4954
taylor_comparison(1000, q, x)
5055
}
5156

52-
#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))]
57+
#[cfg(any(
58+
feature = "num-integer-backend",
59+
target_family = "wasm",
60+
target_env = "musl",
61+
windows
62+
))]
5363
/// Checks if cmp < exp(x). Uses error approximation for an early stop. Whenever the value being
5464
/// compared, `cmp`, is smaller (or greater) than the current approximation minus an `error_term`
5565
/// (plus an `error_term` respectively), then we stop approximating. The choice of the `error_term`
@@ -82,7 +92,12 @@ fn taylor_comparison(bound: usize, cmp: Ratio<BigInt>, x: Ratio<BigInt>) -> bool
8292
false
8393
}
8494

85-
#[cfg(not(any(feature = "num-integer-backend", target_family = "wasm", windows)))]
95+
#[cfg(not(any(
96+
feature = "num-integer-backend",
97+
target_family = "wasm",
98+
target_env = "musl",
99+
windows
100+
)))]
86101
/// The crate `rug` has sufficient optimizations to not require a taylor approximation with early
87102
/// stop. The difference between the current implementation and the one using the optimization
88103
/// above is around 10% faster. We perform the computations with 117 significant bits of

0 commit comments

Comments
 (0)