Fix problem with tpm2-tss dependencies in bundled build.#651
Conversation
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>
There was a problem hiding this comment.
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-sysbuild script to surface dependency link search paths to Cargo during bundled builds. - Update
tss-esapi-sysdocumentation 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.
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
There was a problem hiding this comment.
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 thetss2-*libraries are reported to Cargo. Sincepkg_config::probe()emitscargo:rustc-link-libdirectives, this can put dependency libs (e.g.,-lcrypto) before-ltss2-esys/-ltss2-syson the final link line; with the default-Wl,--as-neededthis ordering can cause the linker to drop needed shared libs and produce undefined references. Consider (1) emittingtss2-*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 {
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Windows. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
| pub fn bundled(out_path: &Path) -> Self { | ||
| for dep in DEPENDENCIES.iter() { | ||
| dep.probe(); | ||
| } | ||
| let version = Self::version(); |
There was a problem hiding this comment.
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.
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>
11a1670 to
b2fe078
Compare
- 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>
|
This seems to be working! Thank you so much!!!! |
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