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 dylib reuse with uplift. #6167

Merged
merged 1 commit into from
Oct 12, 2018
Merged

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Oct 12, 2018

Due to #5460, the files that are copied to the root of the target dir depend on whether or not it is a direct target. This causes a problem with dylibs if you build a dylib directly, and then separately run a target that depends on that dylib. It will run with the dylib path preferring the root dir, which picks up the old dylib. This PR swaps the preference of the dylib search path so that the dylib in the deps dir is preferred.

This is maybe not the best solution for dynamic dependencies. I can imagine if you are trying to create a package, you'll want all of the shared libs along with the binary, and digging through the deps dir is not optimal. However, unconditionally linking dependencies into the root has issues (which #5460 fixed). There are other issues because shared libs do not include a hash in the filename. A grander solution might involve coming up with a better strategy for organizing the target directory to avoid conflicts between targets.

Fixes #6162

@rust-highfive
Copy link

r? @alexcrichton

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

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 12, 2018

📌 Commit b29d4d4 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Oct 12, 2018

⌛ Testing commit b29d4d4 with merge 9801c50...

bors added a commit that referenced this pull request Oct 12, 2018
Fix dylib reuse with uplift.

Due to #5460, the files that are copied to the root of the target dir depend on whether or not it is a direct target. This causes a problem with dylibs if you build a dylib directly, and then separately run a target that depends on that dylib.  It will run with the dylib path preferring the root dir, which picks up the old dylib.  This PR swaps the preference of the dylib search path so that the dylib in the `deps` dir is preferred.

This is maybe not the best solution for dynamic dependencies. I can imagine if you are trying to create a package, you'll want all of the shared libs along with the binary, and digging through the `deps` dir is not optimal.  However, unconditionally linking dependencies into the root has issues (which #5460 fixed).  There are other issues because shared libs do not include a hash in the filename.  A grander solution might involve coming up with a better strategy for organizing the `target` directory to avoid conflicts between targets.

Fixes #6162
@bors
Copy link
Contributor

bors commented Oct 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 9801c50 to master...

@bors bors merged commit b29d4d4 into rust-lang:master Oct 12, 2018
@ehuss ehuss added this to the 1.31.0 milestone 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 doesn't overwrite the build artifact in target/debug on recent toolchains
4 participants