From cd84c5ff67b7cf15e72d64db18c96bfb7312319e Mon Sep 17 00:00:00 2001 From: Stefano Garzarella Date: Thu, 16 May 2024 17:12:45 +0200 Subject: [PATCH] igvm*: specify dependencies' target to avoid feature unification When a dependency is used by multiple packages, Cargo will use the union of all features enabled on that dependency when building it. See https://doc.rust-lang.org/cargo/reference/features.html#feature-unification for more details. These two crates are tools, so let's specify dependencies only for `target_os = "linux"`. This way these dependencies (which can use `std` for example) are not unified with those of SVSM, producing build errors as reported in https://github.com/coconut-svsm/svsm/pull/345 Signed-off-by: Stefano Garzarella --- igvmbuilder/Cargo.toml | 4 +++- igvmmeasure/Cargo.toml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/igvmbuilder/Cargo.toml b/igvmbuilder/Cargo.toml index 3cc507db8..ff1c7897e 100644 --- a/igvmbuilder/Cargo.toml +++ b/igvmbuilder/Cargo.toml @@ -3,7 +3,9 @@ name = "igvmbuilder" version = "0.1.0" edition = "2021" -[dependencies] +# specify dependencies' target to avoid feature unification with SVSM +# see https://doc.rust-lang.org/cargo/reference/features.html#feature-unification +[target.'cfg(all(target_os = "linux"))'.dependencies] bootlib.workspace = true clap = { workspace = true, default-features = true, features = ["derive"] } diff --git a/igvmmeasure/Cargo.toml b/igvmmeasure/Cargo.toml index 5e2e23698..37c4ee737 100644 --- a/igvmmeasure/Cargo.toml +++ b/igvmmeasure/Cargo.toml @@ -3,7 +3,9 @@ name = "igvmmeasure" version = "0.1.0" edition = "2021" -[dependencies] +# specify dependencies' target to avoid feature unification with SVSM +# see https://doc.rust-lang.org/cargo/reference/features.html#feature-unification +[target.'cfg(all(target_os = "linux"))'.dependencies] clap = { workspace = true, default-features = true, features = ["derive"] } hmac-sha512.workspace = true igvm.workspace = true