libswiftCore.dylib could not be loaded

135 views
Skip to first unread message

Varuna Jayasiri

unread,
Apr 29, 2018, 6:29:22 AM4/29/18
to Swift for TensorFlow
I installed the macos package (swift-tensorflow-DEVELOPMENT-2018-04-26-a-osx.pkg). Command line interpreter works fine. But when I try to use it on swift playground I get the following error:
The active toolchain is not compatible with playgrounds. libswiftCore.dylib could not be loaded.

I think this stackoverflow question (https://stackoverflow.com/questions/50081481/can-not-import-tensorflow-for-swift-in-xcode-playground) is also about the same problem.

My Xcode version is 9.3 and macOS version is 10.13.4

Thank you
Varuna

Richard Wei

unread,
Apr 29, 2018, 6:33:21 AM4/29/18
to Varuna Jayasiri, Swift for TensorFlow
Hi Varuna,

You may have created an iOS playground instead of macOS. Swift for TensorFlow doesn’t support iOS playgrounds yet.

Go to the inspector to switch the platform to macOS.


-Richard

--
You received this message because you are subscribed to the Google Groups "Swift for TensorFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swift+un...@tensorflow.org.

Fabrizio Milo

unread,
Apr 29, 2018, 4:06:26 PM4/29/18
to Swift for TensorFlow, Varuna Jayasiri
I was on the same route and fixed the macOS target. The next error is now:

`Cannot load module 'TensorFlow' as ‘Tensorflow’`

Richard Wei

unread,
Apr 29, 2018, 4:14:45 PM4/29/18
to Fabrizio Milo, Swift for TensorFlow, Varuna Jayasiri
“F” should be upper case. 

-Richard

On Apr 29, 2018, at 3:06 PM, Fabrizio Milo <fm...@entropysource.com> wrote:

I was on the same route and fixed the macOS target. The next error is now:

`Cannot load module 'TensorFlow' as ‘Tensorflow’`

<060EEB35-2E3F-44D8-9027-68B15DDBF195.png>

Alex

unread,
Apr 29, 2018, 5:27:59 PM4/29/18
to Swift for TensorFlow, vpjay...@gmail.com
I'm running into this problem as well, unfortunately changing to macOS doesn't seem to fix the issue.  I made sure to select Swift for TensorFlow Development Snapshot under Toolchains. 

Arjun Nayini

unread,
Apr 29, 2018, 5:32:02 PM4/29/18
to Alex, Swift for TensorFlow, vpjay...@gmail.com
Hey Alex -

Can you try:
1. Changing your toolchain
2. Killing the IDE
3. Making a brand new macOS Playground

I was having some weird issues at some point where despite updating the toolchain and switching to a macOS playground, things weren't loading properly until I created a new one.

To unsubscribe from this group and stop receiving emails from it, send an email to swift+unsubscribe@tensorflow.org.



--
Arjun Nayini
630.310.9835 | aana...@gmail.com

Varuna Jayasiri

unread,
Apr 30, 2018, 12:41:55 AM4/30/18
to Swift for TensorFlow
Thanks, that was it. Stupid me.

I tried compiling on XCode (as a project) and it gives a a bunch of link errors, when I import TensorFlow. Quick Help and autocomplete suggestions work.

Any idea what I'm missing?

Ld /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Products/Debug/SwiftTFFirst normal x86_64

    cd /Users/varuna/work/tensorflow/swift/SwiftTFFirst

    export MACOSX_DEPLOYMENT_TARGET=10.13

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Products/Debug -F/Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Products/Debug -filelist /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Intermediates.noindex/SwiftTFFirst.build/Debug/SwiftTFFirst.build/Objects-normal/x86_64/SwiftTFFirst.LinkFileList -mmacosx-version-min=10.13 -Xlinker -object_path_lto -Xlinker /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Intermediates.noindex/SwiftTFFirst.build/Debug/SwiftTFFirst.build/Objects-normal/x86_64/SwiftTFFirst_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain/usr/lib/swift_static/macosx -Xlinker -force_load_swift_libs -lc++ -framework Foundation -Xlinker -add_ast_path -Xlinker /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Intermediates.noindex/SwiftTFFirst.build/Debug/SwiftTFFirst.build/Objects-normal/x86_64/SwiftTFFirst.swiftmodule -Xlinker -dependency_info -Xlinker /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Intermediates.noindex/SwiftTFFirst.build/Debug/SwiftTFFirst.build/Objects-normal/x86_64/SwiftTFFirst_dependency_info.dat -o /Users/varuna/Library/Developer/Xcode/DerivedData/SwiftTFFirst-hazixrqgseudecdrsmyqthbahaep/Build/Products/Debug/SwiftTFFirst


Undefined symbols for architecture x86_64:

  "_TFE_ContextAddFunction", referenced from:

      _$S10TensorFlow8TFEState33_F1EB29DDC3964F4495E8056659BC5464LLC_16programByteCount24entryFunctionNameAddressADSV_SiSPys4Int8VGtcfc in libswiftTensorFlow.a(TensorFlow.o)

  "_TFE_ContextListDevices", referenced from:

      _$S10TensorFlow17_ExecutionContextCACycfc in libswiftTensorFlow.a(TensorFlow.o)

  "_TFE_ContextOptionsSetDevicePlacementPolicy", referenced from:

      _$S10TensorFlow17_ExecutionContextCACycfc in libswiftTensorFlow.a(TensorFlow.o)

  "_TFE_DeleteContext", referenced from:

      _$S10TensorFlow17_ExecutionContextCfd in libswiftTensorFlow.a(TensorFlow.o)

  "_TFE_DeleteContextOptions", referenced from:

      _$S10TensorFlow17_ExecutionContextCACycfc in libswiftTensorFlow.a(TensorFlow.o)


......


"tensorflow::port::InitMain(char const*, int*, char***)", referenced from:

      _InitTensorFlowRuntime in libswiftTensorFlow.a(ctensorflow_init.cpp.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


On Sun, Apr 29, 2018 at 4:03 PM Richard Wei <rx...@google.com> wrote:
Hi Varuna,

You may have created an iOS playground instead of macOS. Swift for TensorFlow doesn’t support iOS playgrounds yet.

Go to the inspector to switch the platform to macOS.

PastedGraphic-1.png

Reply all
Reply to author
Forward
0 new messages