Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

build: install into the macOS style paths #703

Merged
merged 1 commit into from
Feb 28, 2020

Conversation

compnerd
Copy link
Contributor

Install the module into the macOS style paths which are honoured on both
macOS and non-macOS targets. This simplifies the install rules across
all the targets.

@compnerd compnerd force-pushed the install-locations branch 3 times, most recently from e4bc8c9 to 085cf53 Compare February 28, 2020 01:50
Install the module into the macOS style paths which are honoured on both
macOS and non-macOS targets.  This simplifies the install rules across
all the targets.
@dan-zheng
Copy link
Member

Yay! macOS toolchains are working again!

$ cat tf.swift
import TensorFlow
print(Tensor(1))
import PythonKit
print(PythonObject(1))
$ swift tf.swift
1.0
1

But the macOS REPL is super broken (haven't tested Linux REPL):

$ swift
import PythonWelcome to Swift version 5.2-dev (LLVM b3057cffb6, Swift 196e6963bb).
Type :help for assistance.
  1> import PythonKit
  2> PythonObject(1)
error: repl.swift:2:1: error: use of unresolved identifier 'PythonObject'
PythonObject(1)
^~~~~~~~~~~~


  2> import TensorFlow
  3> Tensor(1)
error: repl.swift:3:1: error: use of unresolved identifier 'Tensor'
Tensor(1)
^~~~~~


  3> import alksdjflasdjfsakldfj
  4> # wait what? line above doesn't fail?

And swift build doesn't work anymore (tested on tensorflow/swift-models):

$ swift build
'TensorFlowModels' swift-models: warning: ignoring duplicate product 'Transformer'
swift-models/Models/ImageClassification/DenseNet121.swift:15:8: error: compiling for macOS 10.13, but module 'TensorFlow' has a minimum deployment target of macOS 10.14: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2020-02-27-a.xctoolchain/usr/lib/swift/macosx/TensorFlow.swiftmodule/x86_64.swiftmodule
import TensorFlow
       ^
swift-models/Gym/FrozenLake/main.swift:16:12: error: compiling for macOS 10.13, but module 'PythonKit' has a minimum deployment target of macOS 10.14: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2020-02-27-a.xctoolchain/usr/lib/swift/macosx/PythonKit.swiftmodule/x86_64.swiftmodule
    import PythonKit
           ^
swift-models/Gym/CartPole/main.swift:16:12: error: compiling for macOS 10.13, but module 'PythonKit' has a minimum deployment target of macOS 10.14: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2020-02-27-a.xctoolchain/usr/lib/swift/macosx/PythonKit.swiftmodule/x86_64.swiftmodule
    import PythonKit
           ^

One step at a time 💪

@dan-zheng
Copy link
Member

dan-zheng commented Feb 28, 2020

Merging to unblock progress. validation-test/Python/python_lint.swift can be fixed later.

Edit: holy cow oops, I meant to merge swiftlang/swift#30108 (for which validation-test/Python/python_lint.swift is the only failing test). Oh well.

@dan-zheng dan-zheng merged commit cc21227 into tensorflow:master Feb 28, 2020
@dan-zheng
Copy link
Member

Oops! CI doesn't seem to pass for this PR:

Step 29/36 : WORKDIR /swift-models
 ---> Running in 5730f0d835f9
Removing intermediate container 5730f0d835f9
 ---> c5348eaee397
Step 30/36 : RUN /swift-tensorflow-toolchain/usr/bin/swift build
 ---> Running in 738ce74bc6c6
Fetching https://github.com/apple/swift-protobuf.git
Fetching https://github.com/kylef/Spectre.git
Fetching https://github.com/kylef/Commander.git
Cloning https://github.com/apple/swift-protobuf.git
Resolving https://github.com/apple/swift-protobuf.git at 1.7.0
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.9.1
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.9.0
[1/150] Compiling SwiftProtobuf BinaryDecodingError.swift
[2/150] Compiling SwiftProtobuf BinaryDecodingOptions.swift
[3/150] Compiling SwiftProtobuf BinaryDelimited.swift
[4/150] Compiling SwiftProtobuf BinaryDecoder.swift
[5/150] Compiling SwiftProtobuf BinaryEncodingError.swift
[6/150] Compiling SwiftProtobuf AnyUnpackError.swift
[7/150] Compiling SwiftProtobuf AnyMessageStorage.swift
[8/150] Compiling SwiftProtobuf BinaryEncodingSizeVisitor.swift
[9/150] Compiling SwiftProtobuf Message+AnyAdditions.swift
[10/150] Compiling SwiftProtobuf Message+BinaryAdditions.swift
[11/150] Compiling SwiftProtobuf Message+JSONAdditions.swift
[14/150] Compiling SwiftProtobuf ZigZag.swift
[15/150] Compiling SwiftProtobuf any.pb.swift
[16/150] Compiling SwiftProtobuf ProtobufMap.swift
[17/150] Compiling SwiftProtobuf SelectiveVisitor.swift
[18/150] Compiling SwiftProtobuf duration.pb.swift
[19/150] Compiling SwiftProtobuf empty.pb.swift
[20/150] Compiling SwiftProtobuf Decoder.swift
[21/150] Compiling SwiftProtobuf DoubleParser.swift
[22/150] Compiling SwiftProtobuf Enum.swift
[23/150] Compiling SwiftProtobuf ProtoNameProviding.swift
[24/150] Compiling SwiftProtobuf ProtobufAPIVersionCheck.swift
[25/150] Compiling SwiftProtobuf SimpleExtensionMap.swift
[26/150] Compiling SwiftProtobuf StringUtils.swift
/swift-models/Gym/CartPole/main.swift:18:12: error: no such module 'Python'
    import Python

I wonder if this is a regression or not? cc @compnerd

@compnerd compnerd deleted the install-locations branch February 28, 2020 16:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants