This repository was archived by the owner on Apr 23, 2025. It is now read-only.
Add tensorflow/swift-apis as a SwiftPM dependency. #727
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This enables building
tensorflow/swift-models
using stock toolchains from swift.org/download.swift build
will clone and buildtensorflow/swift-apis
as a regular SwiftPM dependency. Eventually, we would like to stop releasing custom toolchains bundled with pre-installedtensorflow/swift-apis
.Build instructions
It is possible to build
tensorflow/swift-apis
and dependencies liketensorflow/swift-models
using stock toolchains by installing pre-built X10 libraries (currently available only for macOS and Windows).After installing (e.g. to
$HOME/Library
on macOS), build with SwiftPM via the following:$ swift build -Xcc -I$HOME/Library/tensorflow-2.4.0/usr/include -Xlinker -L$HOME/Library/tensorflow-2.4.0/usr/lib -Xswiftc -DTENSORFLOW_USE_STANDARD_TOOLCHAIN
swift test
is known not to work on macOS fortensorflow/swift-apis
and dependencies due to SR-14008:Library not loaded: /usr/lib/swift/libswift_Differentiation.dylib
.Testing
Before merging, let's verify that
swift build
,swift run
, andswift test
works for swift.org/download toolchains across platforms:swift run
andswift test
currently both fail due to SR-14008: