Skip to content

Commit

Permalink
igvm*: specify dependencies' target to avoid feature unification
Browse files Browse the repository at this point in the history
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 #345

Signed-off-by: Stefano Garzarella <[email protected]>
  • Loading branch information
stefano-garzarella committed May 16, 2024
1 parent cc5d35f commit cd84c5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion igvmbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 3 additions & 1 deletion igvmmeasure/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd84c5f

Please sign in to comment.