Skip to content

[REPL] When using the default resource directory, prefer loading Swift dylibs from /usr/lib/swift. #22093

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

Merged

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Jan 24, 2019

rdar://problem/46355503

@mikeash mikeash requested a review from jrose-apple January 24, 2019 19:52
@mikeash
Copy link
Contributor Author

mikeash commented Jan 24, 2019

@swift-ci please test

@jrose-apple
Copy link
Contributor

I don't think this is the right way to go. We should always prefer the dylibs in the compiler resource dir; they just might not be present.

@mikeash mikeash changed the base branch from master to swift-5.0-branch January 24, 2019 21:56
@mikeash mikeash force-pushed the load-libs-from-usrlibswift branch from 3f7e899 to 7cd22bc Compare January 24, 2019 21:57
@mikeash mikeash requested a review from a team as a code owner January 24, 2019 21:57
@mikeash
Copy link
Contributor Author

mikeash commented Jan 24, 2019

As discussed in e-mail, I've retargeted this change to 5.0, and we'll do a slightly different version of it for the longer term.

@mikeash
Copy link
Contributor Author

mikeash commented Jan 24, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3f7e8991882dc5a210111cfa041ed59343f6d752

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3f7e8991882dc5a210111cfa041ed59343f6d752

llvm::sys::path::append(absolutePath, runtimeLibPathWithName);
auto result = dlopen(absolutePath.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (result) return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to be 100% correct here, we still want to search the normal dlopen paths first, then /usr/lib/swift, then the toolchain. Maybe it's better to modify DarwinToolChains.cpp, which just sets DYLD_LIBRARY_PATH up front.

Or maybe it doesn't matter, because there's not going to be anything in /usr/lib/swift/ that conflicts with someone's own library. Hopefully.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're OK, as /usr/lib/swift will only contain the stuff that would be bundled with the compiler.

@mikeash
Copy link
Contributor Author

mikeash commented Jan 25, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7cd22bc3a0dd6ca061d17ea0f0d102948c12c41b

@jrose-apple
Copy link
Contributor

…maybe we should limit this to Apple platforms?

@mikeash
Copy link
Contributor Author

mikeash commented Jan 25, 2019

That seems wise. The proper long-term fix can be more broad.

…t dylibs from /usr/lib/swift.

rdar://problem/46355503
@mikeash mikeash force-pushed the load-libs-from-usrlibswift branch from 7cd22bc to 8358df8 Compare January 25, 2019 18:26
@mikeash
Copy link
Contributor Author

mikeash commented Jan 25, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7cd22bc3a0dd6ca061d17ea0f0d102948c12c41b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7cd22bc3a0dd6ca061d17ea0f0d102948c12c41b

@mikeash mikeash merged commit 1993b4c into swiftlang:swift-5.0-branch Jan 25, 2019
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.

4 participants