Skip to content

[bootstrap] Replace old bootstrap with new bootstrap #2462

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
merged 1 commit into from
Dec 13, 2019

Conversation

aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Dec 13, 2019

We've successfully switched to the new bootstrap script so we can get
rid of the old bootstrap code now.

We've successfully switched to the new bootstrap script so we can get
rid of the old bootstrap code now.
@aciidgh
Copy link
Contributor Author

aciidgh commented Dec 13, 2019

@swift-ci smoke test

@aciidgh aciidgh merged commit cc396d0 into swiftlang:master Dec 13, 2019
@aciidgh aciidgh deleted the remove-old-bootstrap-script branch December 13, 2019 20:36
@dan-zheng
Copy link
Contributor

@aciidb0mb3r: I noticed that the new bootstrap strip no longer adds the @executable_path/../lib/swift/macosx RPATH to SwiftPM tool binaries like swift-build and swift-package.

This led to RPATH issues for toolchains built using build-toolchain-tensorflow (adapted from build-toolchain):

$ swift build
dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-19-a.xctoolchain/usr/bin/swift-build
  Reason: image not found
[1]    45688 abort      swift build

I wonder if you encountered any similar issues?


A temporary fix was us is to re-add the @executable_path/../lib/swift/macosx RPATH for SwiftPM tool binaries.

$ sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-19-a.xctoolchain/usr/bin/swift-build
$ sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-19-a.xctoolchain/usr/bin/swift-package
$ sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-19-a.xctoolchain/usr/bin/swift-run
$ sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-19-a.xctoolchain/usr/bin/swift-test

The discussion at tensorflow/swift#347 has more context.

@dan-zheng
Copy link
Contributor

I did some more investigation.

/usr/lib/swift is added as an RPATH for toolchains built from apple/swift:tensorflow branch, but not for toolchains built from apple/swift:master. This seems related to the build-script -toolchain-stdlib-rpath flag, which is true by default on tensorflow branch but false on master branch: code here.

To support toolchains built with -toolchain-stdlib-rpath=true (non-Swift-in-the-OS use cases), perhaps re-adding the @executable_path/../lib/swift/macosx RPATH in Utilities/bootstrap for SwiftPM tool binaries is a robust solution.

@aciidb0mb3r: does this solution make sense to you? SR-1967 seems like a related issue.

@ematejska
Copy link

@aciidb0mb3r: What do you think? Right now using the package manager is busted for Swift for Tensorflow toolchains due to this.

@ematejska
Copy link

Specifically what about the use-case of using a third-party toolchain on Darwin? They would not be using the OS version of the swift libs since they provide their own.

@aciidgh
Copy link
Contributor Author

aciidgh commented Feb 4, 2020

I think we can add a flag in the bootstrap script to add the rpath. Will that work for tensor flow?

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