Skip to content

Fix problem with tpm2-tss dependencies in bundled build.#651

Merged
Superhepper merged 11 commits into
parallaxsecond:mainfrom
Superhepper:bundled-dependency-problem
Jun 15, 2026
Merged

Fix problem with tpm2-tss dependencies in bundled build.#651
Superhepper merged 11 commits into
parallaxsecond:mainfrom
Superhepper:bundled-dependency-problem

Conversation

@Superhepper

Copy link
Copy Markdown
Collaborator

When doing bundled build where the output is an
executable, i.e. examples, cargo needs to know
where to look for dependencies when compiling
tpm2-tss otherwise one ends up with several
missing symbols errors in the linking stage.

This adds functionality for probing dependencies
of tpm2-tss and report the search paths for the
libraries of those dependencies to cargo.

Fixes #646

When doing bundled build where the output is an
executable, i.e. examples, cargo needs to know
where to look for dependencies when compiling
tpm2-tss otherwise one ends up with several
missing symbols errors in the linking stage.

This adds functionality for probing dependencies
of tpm2-tss and report the search paths for the
libraries of those dependencies to cargo.

Fixes parallaxsecond#646

Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix bundled builds (especially when building an executable, e.g. examples) by ensuring Cargo/rustc can locate and link tpm2-tss’s external dependencies (e.g. OpenSSL), preventing missing-symbol linker errors (Fixes #646).

Changes:

  • Add dependency probing logic to the tss-esapi-sys build script to surface dependency link search paths to Cargo during bundled builds.
  • Update tss-esapi-sys documentation to clarify bundled-build dependency expectations and improve OpenSUSE package installation guidance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
tss-esapi-sys/build.rs Adds dependency probing in bundled builds, intended to emit Cargo link-search info for tpm2-tss dependencies.
tss-esapi-sys/README.md Updates bundled-build notes and expands OpenSUSE dependency installation instructions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tss-esapi-sys/build.rs
Comment thread tss-esapi-sys/build.rs Outdated
Comment thread tss-esapi-sys/build.rs Outdated
Comment thread tss-esapi-sys/README.md Outdated
Comment thread tss-esapi-sys/README.md Outdated
Comment thread tss-esapi-sys/build.rs Outdated
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

tss-esapi-sys/build.rs:166

  • DEPENDENCIES.iter().for_each(Dependency::probe) runs before the tss2-* libraries are reported to Cargo. Since pkg_config::probe() emits cargo:rustc-link-lib directives, this can put dependency libs (e.g., -lcrypto) before -ltss2-esys/-ltss2-sys on the final link line; with the default -Wl,--as-needed this ordering can cause the linker to drop needed shared libs and produce undefined references. Consider (1) emitting tss2-* link directives first (dependents before dependencies) and (2) probing/emitting dependency link info afterwards.
        pub fn bundled(out_path: &Path) -> Self {
            for dep in DEPENDENCIES.iter() {
                dep.probe();
            }
            let version = Self::version();
            let source_path = Self::source(out_path, &version);
            Self::compile(&source_path);
            Self {

Comment thread tss-esapi-sys/build.rs
Comment thread tss-esapi-sys/build.rs
Comment thread tss-esapi-sys/README.md Outdated
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Windows.

Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
@Superhepper Superhepper requested a review from Copilot May 30, 2026 10:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread tss-esapi-sys/build.rs Outdated
Comment thread tss-esapi-sys/README.md Outdated
Comment thread tss-esapi-sys/README.md Outdated
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread tss-esapi-sys/build.rs
Comment on lines 158 to 162
pub fn bundled(out_path: &Path) -> Self {
for dep in DEPENDENCIES.iter() {
dep.probe();
}
let version = Self::version();

@Superhepper Superhepper May 30, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If I emit the metadata of the dependencies after the compile stage then the build on Linux fails because the compiler or linker can not find the libraries.

Comment thread tss-esapi-sys/build.rs Outdated
Comment thread tss-esapi-sys/build.rs Outdated
Comment thread tss-esapi-sys/README.md Outdated
Comment thread tss-esapi-sys/README.md Outdated
Signeeoff-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
before compile.

Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

- Fixed a problem where on some platforms the output
  libraries where installed in `lib64`` directory and
  not the expected `lib` directory.

Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Add tpm2-tss pkgconfig path first in the list
  of paths in PKG_CONFIG_PATH

- Made pkg config report everything possible
  when probing a tpm2-tss library.

Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
@Firstyear

Copy link
Copy Markdown
Collaborator

This seems to be working! Thank you so much!!!!

@Firstyear Firstyear closed this Jun 12, 2026
@Firstyear Firstyear reopened this Jun 12, 2026

@ionut-arm ionut-arm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💯

@Superhepper Superhepper merged commit 1807b27 into parallaxsecond:main Jun 15, 2026
27 checks passed
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.

Unable to build with bundled on opensuse

5 participants