Skip to content

Commit

Permalink
Auto merge of #126094 - petrochenkov:libsearch, r=michaelwoerister
Browse files Browse the repository at this point in the history
linker: Link dylib crates by path

Linkers seem to support linking dynamic libraries by path.
Not sure why the previous scheme with splitting the path into a directory (passed with `-L`) and a name (passed with `-l`) was used (upd: likely due to rust-lang/rust#126094 (comment)).

When we split a library path `some/dir/libfoo.so` into `-L some/dir` and `-l foo` we add `some/dir` to search directories for *all* libraries looked up by the linker, not just `foo`, and `foo` is also looked up in *all* search directories not just `some/dir`.
Technically we may find some unintended libraries this way.
Therefore linking dylibs via a full path is both simpler and more reliable.

It also makes the set of search directories more easily reproducible when we need to lookup some native library manually (like in rust-lang/rust#123436).
  • Loading branch information
bors committed Jul 3, 2024
2 parents bacc593 + d0d1f72 commit 2b3796a
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 2b3796a

Please sign in to comment.