Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq #177

Closed
maxvol opened this issue Apr 24, 2019 · 17 comments
Closed

dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq #177

maxvol opened this issue Apr 24, 2019 · 17 comments

Comments

@maxvol
Copy link
Contributor

maxvol commented Apr 24, 2019

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

@maxvol maxvol changed the title error: dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq dyld: Symbol not found: _$sSly7ElementQz5IndexQzcigTq Apr 24, 2019
@Roslund
Copy link

Roslund commented Apr 29, 2019

I have the same issue.

@dan-zheng
Copy link
Member

Could someone please share a simple reproducer?

@Roslund
Copy link

Roslund commented Apr 29, 2019

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.

@lukegeorge85
Copy link

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?

@hfoffani
Copy link

Same here. Mojave 10.14.4, Xcode 10.2.1, Toolchain 0.3.1
Minimal steps to reproduce it:

  1. install Toolchain as indicated following steps 1,2,3 and 4.
  2. file new project - macos-application-command line tool
  3. name the project - create.
  4. change project to legacy building
  5. modify 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)
6. builds OK
7. run fails:

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
  1. add runpath search paths:
    /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.3.1.xctoolchain/usr/lib/swift/macosx
  2. builds OK
  3. now run fails with:
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.

@maxvol
Copy link
Contributor Author

maxvol commented May 14, 2019

Reproducible with either a macOS playground or a macOS app, also from toolchain from 30 April and Xcode 10.2.1

@F20170604
Copy link

I was having the same issue, so I downgraded my Xcode to 10.0 version. Everything is working absolutely fine in that.

@yeatse
Copy link

yeatse commented May 16, 2019

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

image

This script forces generated executable load the Swift version specified in Build Settings -> Runpath Search Paths instead of the one built in latest Xcode.

@hfoffani
Copy link

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

BradLarson added a commit to BradLarson/AlexNet-Swift that referenced this issue Jun 14, 2019
@dhasl002
Copy link

dhasl002 commented Jul 10, 2019

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

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!

@ProfFan
Copy link

ProfFan commented Dec 14, 2019

@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...

@amit-k-gupta
Copy link

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

Screenshot 2019-12-26 at 11 42 49 AM

@RahulBhalley
Copy link
Contributor

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.

Screen Shot 2019-12-29 at 11 15 55 AM

Solution was suggested by Daisuke in S4TF mailing list.

@RahulBhalley
Copy link
Contributor

If someone is unable to find Hardened Runtime just simply add it by clicking + Capability & selecting it from the list.

@RahulBhalley
Copy link
Contributor

RahulBhalley commented Dec 30, 2019

@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.

@amit-k-gupta
Copy link

amit-k-gupta commented Dec 31, 2019 via email

@dan-zheng
Copy link
Member

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests