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

Don't let pkg-config add system lib dirs to the search path #831

Merged
merged 2 commits into from
Apr 27, 2022

Conversation

jonhoo
Copy link
Contributor

@jonhoo jonhoo commented Apr 13, 2022

In its default configuration, pkg-config adds system-wide library
directories to the linker search path (rust-lang/pkg-config-rs#11).
This causes these directories to be searched before other paths added
by later crates or by -Clink-arg in rustflags. If a library is present in
the system-wide directory and a later build step wants to specifically
link against a different version of that library in another path, the linker
will choose the library from the first search directory it finds. If the linker
doesn't find a library in any of the specified search directories, it falls
back on system-wide paths, so we don't need to print the
path we found libssh2 in if it is in one of those system paths.

See rust-lang/libz-sys#50 for the same fix to libz that landed a while back.
See also alexcrichton/curl-rust#441 for the same fix to libcurl-sys.

Jon Gjengset added 2 commits April 13, 2022 09:44
In its default configuration, pkg-config adds system-wide library
directories to the linker search path (rust-lang/pkg-config-rs#11).
This causes these directories to be searched before other paths added
by later crates or by -Clink-arg in rustflags. If a library is present in
the system-wide directory and a later build step wants to specifically
link against a different version of that library in another path, the linker
will choose the library from the first search directory it finds. If the linker
doesn't find a library in any of the specified search directories, it falls
back on system-wide paths, so we don't need to print the
path we found libssh2 in if it is in one of those system paths.

See rust-lang/libz-sys#50 for the same fix to libz that landed a while back.
See also alexcrichton/curl-rust#441 for the same fix to libcurl-sys.
@joshtriplett joshtriplett merged commit 4d104dd into rust-lang:master Apr 27, 2022
@jonhoo jonhoo deleted the patch-1 branch June 13, 2022 20:39
@ehuss
Copy link
Contributor

ehuss commented Jan 20, 2023

@jonhoo I think this was accidentally reverted in #839. Is that a problem for you?

@jonhoo
Copy link
Contributor Author

jonhoo commented Jan 20, 2023

@ehuss Interesting. I haven't experience breakage as a result at least, but I definitely do think the change should be re-introduced since it's the more correct behavior.

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