Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for non pkg-config tpm2-tss installs. #477

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

Superhepper
Copy link
Collaborator

@Superhepper Superhepper commented Dec 9, 2023

This adds support for specifying an install path of tpm2-tss libraries and header files in order to make it possible to build crate without having to relay on pkg-config.

@Superhepper Superhepper force-pushed the win-build branch 2 times, most recently from 5c31929 to cef6a40 Compare December 10, 2023 10:24
@wiktor-k
Copy link
Collaborator

Very interesting development!

By the way Github supports windows CI runners so maybe it would be useful to at least run cargo build there?

@Superhepper
Copy link
Collaborator Author

Yeah this is just a test. I would really like to be able run the tests before committing anything.

@Superhepper Superhepper force-pushed the win-build branch 5 times, most recently from 6e7cfcb to 89a476e Compare December 18, 2023 20:57
@Superhepper Superhepper force-pushed the win-build branch 20 times, most recently from c80915e to 5bf565c Compare March 26, 2024 14:12
@wiktor-k
Copy link
Collaborator

Wow, that's great! Given that the simulator has ms in its name I guess this is just a matter of time. For the record I've also had slight "problems" with running integration tests on Windows: https://github.com/wiktor-k/ssh-agent-lib/pull/25/files#diff-b1a180c7db3d68d63c6a33ea491b590c09cca209c930eae52c1f6dae2b00768e

👋

Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite a complicated build file, I'm surprised something like it doesn't exist more generally..

Thanks for the patch!

//See this issue: https://github.com/parallaxsecond/rust-cryptoki/issues/12
.generate_comments(false)
.blocklist_type("max_align_t")
// Needed for windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the issue here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you compile under windows ( I used msvc 2022) you get a lot of errors of structs that it some how thinks are needed but not available probably due to it importing "windows.h" or something. So I just blocked everything that caused an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant when you generate the bindings on a windows machine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you compile under windows ( I used msvc 2022) you get a lot of errors of structs that it some how thinks are needed but not available probably due to it importing "windows.h" or something.

I wonder if WIN32_LEAN_AND_MEAN would help here... (note that I'm no C/C++ dev so this may be wildly wrong)...

tss-esapi-sys/build.rs Outdated Show resolved Hide resolved
tss-esapi-sys/build.rs Outdated Show resolved Hide resolved
tss-esapi-sys/build.rs Outdated Show resolved Hide resolved
- Adds support for specifying path to the tpm2-tss libraries and
  header files using the environment variable ```TPM2_TSS_PATH```.
  The specified path is expected to have the following layout:
  | -> <Specified path>
  |    | -> include
  |       | -> tss2
  |           | -> tss2_esys.h
  |
  |    | -> lib
  |        | -> tss2_esys.lib (or .so)

Signed-off-by: Jesper Brynolf <[email protected]>
let min_version_req = VersionReq::parse(&min_version_req_str).unwrap_or_else(|e| {
panic!(
"[Internal Error]: Failed to parse minimum tpm2-tss library version \
requirement. Error: `{}`. Please report this.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the "Please report this" bit, we should do it more.

tss-esapi-sys/build.rs Outdated Show resolved Hide resolved
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@wiktor-k
Copy link
Collaborator

wiktor-k commented Apr 8, 2024

It looks good on a quick look. Is there a plan to add a windows target that at least builds it and checks that it doesn't regress?

I've seen people commenting on how to build it and such a CI config would be one place to point them... 🤔

@Superhepper
Copy link
Collaborator Author

Superhepper commented Apr 8, 2024

@wiktor-k
I have it on my list of things I want to improve. But I have found no way of accomplishing it. So I am going to create a ticket for it and if some Windows savvy github actions enthusiast could take a look at it. It would be great.

@Superhepper Superhepper merged commit b75d2ad into parallaxsecond:main Apr 8, 2024
12 checks passed
@Superhepper Superhepper mentioned this pull request Apr 8, 2024
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-author: Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 13, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-authored-by: Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Sep 20, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-authored-by: Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Superhepper added a commit to Superhepper/rust-tss-esapi that referenced this pull request Oct 2, 2024
When parallaxsecond#477 got merged it became possible to build
using a path to the ```tpm2-tss``` installation
instead of depending on ```pkg-config```.

This made it possible to build under Windows. To
further increase the support for the windows
platform this commit moves the option for TBS
TCTI that is being introduced in parallaxsecond#523 into a
separate commit.

This commit also updates the documentation
regarding building using an installation
folder.

Co-authored-by: Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants