tensorflow / swift

Swift for TensorFlow
https://tensorflow.org/swift
Apache License 2.0
6.13k stars 608 forks source link

Xcode runtime failure #435

Closed ematejska closed 3 years ago

ematejska commented 4 years ago
Imported from JIRA: https://bugs.swift.org/browse/TF-932 Type: Bug Priority: Major
Reporter: Colin Stark Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Xcode builds executables that fail at runtime because of a code signing problem blocking use of dylib.

Platform: MacOS 10.14.5

Xcode: 11.1 (11A1027)

Toolchain: Swift for TensorFlow 0.5 Release

Build environment modded as per: https://github.com/tensorflow/swift/blob/master/Installation.md#releases

Build from cmd line works fine, e.g. for a simple "Hello world" demo with "import TensorFlow":

swiftc -O -sdk xcrun --show-sdk-path RawTest/RawTest/main.swift

... and this executes without a problem.

However, debug build and run of this program as a terminal MacOS app in Xcode fails thus:

dyld: Library not loaded: @rpath/libswiftTensorFlow.dylib {{ {{ Referenced from: XXXXX/Library/Developer/Xcode/DerivedData/MyInference-ajxlsjwizfzbyweeqlcoqngtufgy/Build/Products/Debug/MyInference}}}} {{ {{ Reason: no suitable image found. Did find:}}}} {{ {{ /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.5.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib: code signature in (/Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.5.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)}}}} {{ {

{ /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.5.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib: code signature in (/Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.5.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)} }}}

Comment by Dan Zheng [ 11 Nov 2019 ]

mkdir Foo
cd Foo
swift package init --type executable
# Edit sources to import and use TensorFlow.
swift test
BradLarson commented 3 years ago

I don't believe this is currently an issue with our toolchains, but if it does persist feel free to reopen this.