From 57fb3b827f689cbe6d81a2ad3baddaacdeba7c44 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 20 Jan 2026 20:51:42 +0000 Subject: [PATCH] build: Allow any v4 libtss I tried to compile with the current git version of libtss2 (4.1.0-foo) and was greeted with a build error. Major versions should maintain API compatibility, so I don't expect any issue compiling with any version from the 4 major version series. Adjust the semver accordingly. To make compilation successful with git checkouts, also strip the prerelease info when comparing versions. Without that stripping, compilation still failed. Signed-off-by: Alexander Graf --- nitro-tpm-attest/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nitro-tpm-attest/build.rs b/nitro-tpm-attest/build.rs index 05a702d..34bf819 100644 --- a/nitro-tpm-attest/build.rs +++ b/nitro-tpm-attest/build.rs @@ -5,12 +5,13 @@ fn main() { // While tss-esapi 7.6 supports a minimum TSS version of 2.4.6, behavior between major version // differs significantly let tss_version_requirement = - semver::VersionReq::parse("4.0.0").expect("Failed to parse version requirement"); + semver::VersionReq::parse(">=4.0.0-0, <5.0.0").expect("Failed to parse version requirement"); let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION").expect("DEP_TSS2_ESYS_VERSION not set"); - let tss_version = + let mut tss_version = semver::Version::parse(&tss_version_string).expect("Failed to parse DEP_TSS2_ESYS_VERSION"); + tss_version.pre = semver::Prerelease::EMPTY; assert!( tss_version_requirement.matches(&tss_version),