Skip to content

[TF] Set default RPATH to toolchain stdlib instead of /usr/lib/swift on macOS. #27206

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 2 commits into from
Sep 17, 2019

Conversation

dan-zheng
Copy link
Contributor

Previously, the default RPATH was set to /usr/lib/swift.
This caused linker issues on macOS, as tensorflow-branch-specific modules like
TensorFlow and Python do not exist in /usr/lib/swift.

This patch defaults the -toolchain-stdlib-rpath flag to be true, so the
default RPATH is the toolchain standard library instead of /usr/lib/swift.

With this default, the linker issues are fixed. A -no-toolchain-stdlib-path
flag is added to opt out of this default, making /usr/lib/swift the RPATH.

Add positive/negative tests.
swift test works on macOS for packages that import/use TensorFlow again (namely https://github.com/tensorflow/swift-apis).

Partially reverts #24787. Resolves TF-797.

Previously, the default RPATH was set to `/usr/lib/swift`.
This caused linker issues on macOS, as tensorflow-branch-specific modules like
TensorFlow and Python do not exist in `/usr/lib/swift`.

This patch defaults the `-toolchain-stdlib-rpath` flag to be true, so the
default RPATH is the toolchain standard library instead of `/usr/lib/swift`.

With this default, the linker issues are fixed. A `-no-toolchain-stdlib-path`
flag is added to opt out of this default, making `/usr/lib/swift` the RPATH.

Add positive/negative tests.
`swift test` works on macOS for packages that import/use TensorFlow again.

Partially reverts swiftlang#24787.
Resolves TF-797.
@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Sep 16, 2019
@dan-zheng dan-zheng requested review from rxwei and bgogul September 16, 2019 23:38
Copy link
Contributor

@bgogul bgogul left a comment

Choose a reason for hiding this comment

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

Thanks, Dan!

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng dan-zheng changed the title Set default RPATH to toolchain stdlib instead of /usr/lib/swift. [TF] Set default RPATH to toolchain stdlib instead of /usr/lib/swift on macOS. Sep 16, 2019
@beccadax
Copy link
Contributor

Suggestion: Do most of this in master and just flip the default from false to true in TensorFlow.

dan-zheng added a commit to dan-zheng/swift that referenced this pull request Sep 17, 2019
Add `-no-toolchain-stdlib-rpath` flag: the negative version of
`-toolchain-stdlib-rpath`.

Make `-no-toolchain-stdlib-rpath` be the default: use `/usr/lib/swift` as
default RPATH on Darwin platforms instead of toolchain standard library.

Adapted from swiftlang#27206.

tensorflow branch requires the opposite default (use toolchain standard
library as RPATH) because some stdlib modules like TensorFlow do not exist in
`/usr/lib/swift`.
@dan-zheng
Copy link
Contributor Author

Suggestion: Do most of this in master and just flip the default from false to true in TensorFlow.

Done in #27207, please review.
If #27207 is merged, I'll then adapt tensorflow branch changes to minimize the diff.

…rpath`.

- Change existing driver invocations in Driver/linker-rpath to use explicit
  `-no-toolchain-stdlib-rpath` flag.
- Add tests for implicit `-toolchain-stdlib-rpath` flag.
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow linux CPU

@dan-zheng dan-zheng merged commit b45f2db into swiftlang:tensorflow Sep 17, 2019
@dan-zheng dan-zheng deleted the TF-797 branch September 17, 2019 19:37
dan-zheng added a commit that referenced this pull request Sep 17, 2019
…` on macOS. (#27206)

Previously, the default RPATH was set to `/usr/lib/swift`.
This caused linker issues on macOS, as tensorflow-branch-specific modules like
TensorFlow and Python do not exist in `/usr/lib/swift`.

This patch defaults the `-toolchain-stdlib-rpath` flag to be true, so the
default RPATH is the toolchain standard library instead of `/usr/lib/swift`.

With this default, the linker issues are fixed. A `-no-toolchain-stdlib-path`
flag is added to opt out of this default, making `/usr/lib/swift` the RPATH.

Add positive/negative tests.
`swift test` works on macOS for packages that import/use TensorFlow again.

Partially reverts #24787.
Resolves TF-797.
@ematejska
Copy link
Contributor

Awesome!

dan-zheng added a commit that referenced this pull request Sep 21, 2019
Add `-no-toolchain-stdlib-rpath` flag: the negative version of
`-toolchain-stdlib-rpath`.

Make `-no-toolchain-stdlib-rpath` be the default: use `/usr/lib/swift` as
default RPATH on Darwin platforms instead of toolchain standard library.

Adapted from #27206.

tensorflow branch requires the opposite default (use toolchain standard
library as RPATH) because some stdlib modules like TensorFlow do not exist in
`/usr/lib/swift`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tensorflow This is for "tensorflow" branch PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants