Closed maxvol closed 4 years ago
I have the same issue.
Could someone please share a simple reproducer?
I'm not sure how to reproduce. But From what I've figured out, It seems like the problem is that in Xcode 10.2, Xcode uses the version of the swift standard library that's installed on the system, which differs from swift for TensorFlow standard library.
It works fine in Xcode 10.1 and in the Terminal.
On Mojave, Xcode 10.2, Toolchain 0.3 getting this result for a command-line macOS app -
dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq Referenced from: /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3-a.xctoolchain/usr/lib/swift/macosx/libswiftPython.dylib Expected in: /usr/lib/swift/libswiftCore.dylib in /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3-a.xctoolchain/usr/lib/swift/macosx/libswiftPython.dylib
I configured the project as described here - https://stackoverflow.com/questions/55782961/swift-for-tensorflow-dyld-symbol-not-found-ssly7elementqz5indexqzcigtq
I'm the poster of the original question. Any update on this issue? Is there any additional info I can provide to assist?
Same here. Mojave 10.14.4, Xcode 10.2.1, Toolchain 0.3.1 Minimal steps to reproduce it:
main.swift
to add some code:
import TensorFlow
let t : Tensor<Float> = [[1,2],[3,4]]
(code completion for Tensor
type works so the framework is recognized)
dyld: Library not loaded: @rpath/libswiftPython.dylib
Referenced from: /Users/hernan/Library/Developer/Xcode/DerivedData/swift-t6-abxqyqiwnjnmhzfhehvbfsxkaccz/Build/Products/Debug/swift-t6
Reason: image not found
Program ended with exit code: 9
/Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3.1.xctoolchain/usr/lib/swift/macosx
dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq
Referenced from: /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3.1.xctoolchain/usr/lib/swift/macosx/libswiftPython.dylib
Expected in: /usr/lib/swift/libswiftCore.dylib
in /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3.1.xctoolchain/usr/lib/swift/macosx/libswiftPython.dylib
Program ended with exit code: 9
I assume it's picking up the standard libswiftCore.dylib
instead of the Toolchain's one.
Reproducible with either a macOS playground or a macOS app, also from toolchain from 30 April and Xcode 10.2.1
I was having the same issue, so I downgraded my Xcode to 10.0 version. Everything is working absolutely fine in that.
Adding a Run Script
in Build Phases
temporarily fixes this issue:
install_name_tool -delete_rpath /usr/lib/swift $TARGET_BUILD_DIR/$PRODUCT_NAME || true
This script forces generated executable load the Swift version specified in Build Settings -> Runpath Search Paths
instead of the one built in latest Xcode.
Thanks @Yeatse. Your workaround fixed the problem in the steps I mentioned before.
Adding a Run Script in Build Phases temporarily fixes this issue:
install_name_tool -delete_rpath /usr/lib/swift $TARGET_BUILD_DIR/$PRODUCT_NAME || true
Adding a
Run Script
inBuild Phases
temporarily fixes this issue:install_name_tool -delete_rpath /usr/lib/swift $TARGET_BUILD_DIR/$PRODUCT_NAME || true
Unfortunately, this does not work for me on Xcode 10.2.1
This is the error I get
error: install_name_tool: can't open file: /Users/dhaslam/Library/Developer/Xcode/DerivedData/Swift4Tensorflow-djrxnkrfydcxuicsyntnenxqidsq/Build/Products/Debug/Swift4Tensorflow (No such file or directory)
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
This folder does not exist:
/Users/dhaslam/Library/Developer/Xcode/DerivedData/Swift4Tensorflow-djrxnkrfydcxuicsyntnenxqidsq/Build/
Any help would be great. I would like to avoid changing my Xcode version. Thanks!
@dan-zheng Can confirm that this is also happening with the Jupyter environment on macOS as well. I am on XCode 11.2.
/usr/lib/swift
slip in somewhere, but not in the compiled libraries...
EDIT: Can work around by using DYLD_LIBRARY_PATH=${SWIFT_TOOLCHAIN_PATH}/usr/lib/swift/macosx
, but then I got EXC_BAD_ACCESS
for library calls...
Hi @dan-zheng I tried to add the above run script as suggested by you, but unfortunately, it didn't work. I am using XCode 11.2.1(11B53). The build failed to compile and I got below errors
In Xcode, checkmark Signing & Capabilities > Hardened Runtime > Disable Library Validation under Target setting of your project. It resolved this problem for me & I hope it helps others too! Also I did not have to use run script.
Solution was suggested by Daisuke in S4TF mailing list.
If someone is unable to find Hardened Runtime just simply add it by clicking + Capability & selecting it from the list.
@dan-zheng this seems to be a problem with code signing that prevents the S4TF program from running in Xcode. I feel that the solution should be documented in Installation readme to make it easy for Xcode users to get started with S4TF & not stay restricted to only REPL.
Edit: I've added a new PR regarding this.
You guys can please answer the question here. As stackOverflow is accessed by almost every developer
https://stackoverflow.com/questions/59340366/cannot-import-tensorflow-in-swift-playground
Amit Kumar Gupta GMail amitgupta.lnct@gmail.com | Twitter https://twitter.com/Amit__G | LinkedIn https://www.linkedin.com/in/amitguptalnct/ Skype: amitgupta.lnct Ph. No:9164752648
On Mon, Dec 30, 2019 at 6:51 AM Rahul Bhalley notifications@github.com wrote:
@dan-zheng https://github.com/dan-zheng this seems to be a problem with code signing that prevents the S4TF program from running in Xcode. I feel that the solution should be documented in Installation readme to make it easy for Xcode users to get started with S4TF & not stay restricted to only REPL.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/swift/issues/177?email_source=notifications&email_token=ABMBCXAFIXXKQ5QS5LH2D7TQ3FEKHA5CNFSM4HIE26QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZMWBY#issuecomment-569559815, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMBCXDRSH3R2SR5D7ZUYBLQ3FEKHANCNFSM4HIE26QA .
I think the discussion is no longer related to the original issue dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq
, so I'll close this issue now.
If anyone encounters new issues, please create a new issue!
On Mojave, Xcode 10.2, Toolchain 0.3 getting this result for a command-line macOS app -
I configured the project as described here - https://stackoverflow.com/questions/55782961/swift-for-tensorflow-dyld-symbol-not-found-ssly7elementqz5indexqzcigtq