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

Fix default DYLD_FALLBACK_LIBRARY_PATH on MacOS. #6625

Merged
merged 1 commit into from
Feb 4, 2019

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Feb 4, 2019

On MacOS, dyld uses the default $(HOME)/lib:/usr/local/lib:/lib:/usr/lib for DYLD_FALLBACK_LIBRARY_PATH when it is not set. #6355 switched cargo to use DYLD_FALLBACK_LIBRARY_PATH, which means the default paths no longer worked. This explicitly adds the defaults back to the end of the list.

Fixes #6623

@rust-highfive
Copy link

r? @dwijnand

(rust_highfive has picked a reviewer for you, use r? to override)

@ehuss
Copy link
Contributor Author

ehuss commented Feb 4, 2019

I think we should consider backporting to beta since this is a regression from stable.

@ehuss ehuss force-pushed the fix-macos-fallback-path branch from 2697783 to e1d0761 Compare February 4, 2019 04:36
@alexcrichton
Copy link
Member

@bors: r+

Sounds good to me! A backport to beta also sound good to me

@bors
Copy link
Contributor

bors commented Feb 4, 2019

📌 Commit e1d0761 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Feb 4, 2019

⌛ Testing commit e1d0761 with merge f18c9d56c6e8551c3e519261ed0a3994000eace0...

@bors
Copy link
Contributor

bors commented Feb 4, 2019

💔 Test failed - checks-travis

@dwijnand
Copy link
Member

dwijnand commented Feb 4, 2019

@bors retry

r? @alexcrichton

@bors
Copy link
Contributor

bors commented Feb 4, 2019

⌛ Testing commit e1d0761 with merge 0dbb2fc...

bors added a commit that referenced this pull request Feb 4, 2019
Fix default DYLD_FALLBACK_LIBRARY_PATH on MacOS.

On MacOS, dyld uses the default `$(HOME)/lib:/usr/local/lib:/lib:/usr/lib` for `DYLD_FALLBACK_LIBRARY_PATH` when it is not set.  #6355 switched cargo to use `DYLD_FALLBACK_LIBRARY_PATH`, which means the default paths no longer worked. This explicitly adds the defaults back to the end of the list.

Fixes #6623
@bors
Copy link
Contributor

bors commented Feb 4, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: alexcrichton
Pushing 0dbb2fc to master...

@bors bors merged commit e1d0761 into rust-lang:master Feb 4, 2019
@josephg
Copy link

josephg commented Feb 4, 2019

So fast! Thanks everyone!!

bors added a commit that referenced this pull request Feb 4, 2019
[BETA] Fix default DYLD_FALLBACK_LIBRARY_PATH on MacOS.

Backport of #6625.
bors added a commit to rust-lang/rust that referenced this pull request Feb 10, 2019
Bump cargo to 865cb70

Merged PRs:

* Replace util::without_prefix with Path::strip_prefix rust-lang/cargo#6620
* keep track of crates that are whitelisted to be used even if yanked rust-lang/cargo#6611
* Fix default DYLD_FALLBACK_LIBRARY_PATH on MacOS. rust-lang/cargo#6625
* Bail when trying to run "test --doc --no-run" rust-lang/cargo#6628
* In cargo test's help, add that examples are built rust-lang/cargo#6619
* Extract & re-use filter_targets in cargo_compile rust-lang/cargo#6621
* Test cleanup: remove unnecessary with_status(0) rust-lang/cargo#6630
* Fix run's help message rust-lang/cargo#6631
* Some updates to bash completion. rust-lang/cargo#6644
* Introduce Source::download_now rust-lang/cargo#6637
* Switch from unused_imports to deprecated to test unfixable warnings rust-lang/cargo#6649
bors added a commit to rust-lang/rust that referenced this pull request Feb 11, 2019
Bump cargo to 865cb70

Merged PRs:

* Replace util::without_prefix with Path::strip_prefix rust-lang/cargo#6620
* keep track of crates that are whitelisted to be used even if yanked rust-lang/cargo#6611
* Fix default DYLD_FALLBACK_LIBRARY_PATH on MacOS. rust-lang/cargo#6625
* Bail when trying to run "test --doc --no-run" rust-lang/cargo#6628
* In cargo test's help, add that examples are built rust-lang/cargo#6619
* Extract & re-use filter_targets in cargo_compile rust-lang/cargo#6621
* Test cleanup: remove unnecessary with_status(0) rust-lang/cargo#6630
* Fix run's help message rust-lang/cargo#6631
* Some updates to bash completion. rust-lang/cargo#6644
* Introduce Source::download_now rust-lang/cargo#6637
* Switch from unused_imports to deprecated to test unfixable warnings rust-lang/cargo#6649
glandium added a commit to glandium/rustup.rs that referenced this pull request Apr 16, 2019
When loading and linking a dynamic library or bundle, dlopen
searches in LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PWD, and
DYLD_FALLBACK_LIBRARY_PATH.
In the Mach-O format, a dynamic library has an "install path."
Clients linking against the library record this path, and the
dynamic linker, dyld, uses it to locate the library.
dyld searches DYLD_LIBRARY_PATH *before* the install path.
dyld searches DYLD_FALLBACK_LIBRARY_PATH only if it cannot
find the library in the install path.
Setting DYLD_LIBRARY_PATH can easily have unintended
consequences.

See https://users.rust-lang.org/t/subprocess-and-dynamic-library-linking-problem-interaction/7873/10
See https://trac.macports.org/ticket/57692
See https://bugzilla.mozilla.org/show_bug.cgi?id=1536486

This is the same change as was applied to cargo in
rust-lang/cargo#6355

See also rust-lang/cargo#6625 and
rust-lang/cargo#6625
@Lord-Kamina
Copy link

Lord-Kamina commented Aug 16, 2019

This is still an issue because Cargo is setting DYLD_LIBRARY_PATH still, and this overrides default system search paths. By contrast, DYLD_FALLBACK_LIBRARY_PATH is only searched if a suitable dylib cannot be found in default paths.

EDIT: Ignore me, it's not cargo but something else, it seems.

Sent with GitHawk

@ehuss ehuss modified the milestones: 1.34.0, 1.33.0 Feb 6, 2022
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.

Cargo test is not loading dynamic library (macos)
7 participants