rust-lang / rust-lang/ssh2-rs

pc file includes absolute paths

Open
#340 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
566
Forks
163
Avg merge
4h 51m
Merged PRs (30d)
2

Description

Hi,

I've noticed that the .pc file generated by the pkg-config call in libssh2-sys's build.rs includes absolute paths to the build directory. This causes issues for build systems that check the build output for reproducibility (and my particular case leads to cache misses for prebuilt artifacts).

Would things break if the paths were relative or if the .pc file simply wasn't generated? I'm using this as a workaround for now:

diff --git a/build.rs b/build.rs
index c4425ee..f99f132 100644
--- a/build.rs
+++ b/build.rs
@@ -173,6 +173,7 @@ fn main() {
         .unwrap();
     let version = &version_line[version_line.find('"').unwrap() + 1..version_line.len() - 1];
 
+    /*
     let pkgconfig = dst.join("lib/pkgconfig");
     fs::create_dir_all(&pkgconfig).unwrap();
     fs::write(
@@ -188,6 +189,7 @@ fn main() {
             .replace("@LIBSSH2VER@", version),
     )
     .unwrap();
+    */
 
     cfg.warnings(false);
     cfg.compile("ssh2");

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libssh2-sys/build.rs around the pkg-config call at line 179 and inspect how the generated .pc file receives build-directory paths. Check whether relative paths or omitting the .pc file preserves the expected build output. Done means the generated output no longer embeds absolute build paths without breaking the reported libssh2 metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.