Swift: libswiftCore.dylib could not be loaded.

Created on 27 Apr 2018  ·  9Comments  ·  Source: tensorflow/swift

Most helpful comment

Finally I reproduced.
You created iOS or tvOS Playground project.
You should create macOS playground version.

swiftimg-1
swiftimg-2

All 9 comments

Same here 👍 👆

Hello, make sure that your command is right In origin:
export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"
1) check is /Library/Developer/Toolchains/swift-latest symlink available, and you add ${PATH} at the end.
2) Also, could you please open Terminal and show result of commands:
env
ls -l /Library/Developer/Toolchains/
3) It will be easier to investigate if you create macOS command line project and put your code in it.
4) Do you have any other version of Xcode (any preview version?)
5) Restart you Xcode after applying changes.

@VolodymyrPavliukevych
This is the result of running env:

SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/pq/h4sqgr_552381wv92g_ywbf40000gp/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.DeXaKgxXux/Render
TERM_PROGRAM_VERSION=404
TERM_SESSION_ID=22A4E8D5-84C7-4B12-B9B5-260C01E3334F
USER=ibxxxm.kxxxh
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.7lxxLLx7is/Listeners
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Library/Developer/Toolchains
LANG=en_US.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/ibrahim.kteish
LOGNAME=ibrahim.kteish
_=/usr/bin/env

The following is for ls -l /Library/Developer/Toolchains/

total 0
lrwxr-xr-x  1 root  wheel   83 Apr 27 10:39 swift-latest -> /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain
drwxr-xr-x  7 root  wheel  224 Apr 27 10:39 swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain

@VolodymyrPavliukevych
env command:

PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:/Users/jason/.composer/vendor/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/mysql/bin
SHLVL=1
PWD=/Users/jason
OLDPWD=/Users/jason
ZSH=/Users/jason/.oh-my-zsh

ls command:

ls -l /Library/Developer/Toolchains 
total 0
lrwxr-xr-x  1 root  wheel   83 Apr 27 12:58 swift-latest -> /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain
drwxr-xr-x  7 root  wheel  224 Apr 27 12:58 swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain

@VolodymyrPavliukevych
REPL works well.

➜  ~ swift
Welcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44). Type :help for assistance.
  1> import TensorFlow
  2> var x = Tensor([[1,2],[3,4]])
2018-04-27 17:49:00.234710: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
x: TensorFlow.Tensor<Double> = [[1.0, 2.0], [3.0, 4.0]]
  3> x + x
$R0: TensorFlow.Tensor<Double> = [[2.0, 4.0], [6.0, 8.0]]
  4> 

Finally I reproduced.
You created iOS or tvOS Playground project.
You should create macOS playground version.

swiftimg-1
swiftimg-2

I Solved mine by closing the simulator

As you can see, currently swift for TensorFlow built only for x86 platform.

lipo  -info /Library/Developer/Toolchains/swift-latest/usr/lib/swift/macosx/libswiftCore.dylib
Architectures in the fat file: /Library/Developer/Toolchains/swift-latest/usr/lib/swift/macosx/libswiftCore.dylib are: x86_64 

Instead of default

/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvos/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchsimulator/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCore.dylib

Closed.
Currently, Swift for TensorFlow only supports macOS playgrounds. Make sure to select "macOS" when creating a playground!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zandew picture Zandew  ·  3Comments

ifsheldon picture ifsheldon  ·  4Comments

johndpope picture johndpope  ·  6Comments

khirotaka picture khirotaka  ·  5Comments

RogerS49 picture RogerS49  ·  5Comments