Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library not loaded: @rpath/libswiftCore.dylib sourcekitten #159

Closed
maltzsama opened this issue Jan 30, 2015 · 24 comments
Closed

Library not loaded: @rpath/libswiftCore.dylib sourcekitten #159

maltzsama opened this issue Jan 30, 2015 · 24 comments
Assignees
Labels
Milestone

Comments

@maltzsama
Copy link

I did uninstall of jazzy, updated gem, but nothing working

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten
  Reason: image not found
/usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten.rb:51:in `run_sourcekitten': Running `/usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten doc` failed:  (RuntimeError)
    from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/lib/jazzy/doc_builder.rb:55:in `build'
    from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jazzy-0.1.0/bin/jazzy:15:in `<top (required)>'
    from /usr/local/var/rbenv/versions/2.1.5/bin/jazzy:23:in `load'
    from /usr/local/var/rbenv/versions/2.1.5/bin/jazzy:23:in `<main>'
@segiddins
Copy link
Collaborator

@maltzsama do you have Xcode (>= 6.1.1) installed as /Applications/Xcode.app?

@AndrewHartAR
Copy link

I'm getting this same issue, and I have XCode 6.1.1 installed.

@beltex
Copy link
Contributor

beltex commented Feb 1, 2015

Seems that for some reason, RubyGems is not downloading the symlink Current -> A inside of lib/jazzy/sourcekitten/SourceKittenFramework.framework, which is why the rpath is failing (as it expects ../Versions/Current/Frameworks). This may not have been noticed before if you have installed SourceKitten standalone, as it installs the needed dylibs at /Library/Frameworks/SourceKittenFramework.framework/Versions/Current/Frameworks which is another valid rpath (can check via otool -l on the SourceKitten binary). 0.0.20 works fine, this is new since SourceKittens Makefile and install structure has changed a bunch.

For those who need a quick work around in the meantime.

# This will tell you the path to your RubyGem install. For example: /Library/Ruby/Gems/2.0.0/
gem env

cd <RUBY_GEM_PATH>/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/
sudo install_name_tool -add_rpath "@executable_path/SourceKittenFramework.framework/Versions/A/Frameworks" sourcekitten

@maltzsama
Copy link
Author

This works fine 👍

@naterhat
Copy link

naterhat commented Feb 7, 2015

worked for me too.

@AliSoftware
Copy link

This patch does not seem to be sufficient for me. Now it can't find libclang :/

I installed jazzy this weekend with @jpsim, using a simple sudo gem install jazzy, so I got the latest version 0.1.0 right now. (and I never installed SourceKitten itself on that computer)

Before the patch I got this error with libswiftCore.dylib not being found, like others above, so I tried to apply the quick fix:

$ pwd
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten
$ sudo install_name_tool -add_rpath "@executable_path/SourceKittenFramework.framework/Versions/A/Frameworks" sourcekitten
Password:

And tried to launch jazzy again.

The error changed… but now it can't find libclang.dylib:

dyld: Library not loaded: @rpath/libclang.dylib
  Referenced from: /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/./SourceKittenFramework.framework/SourceKittenFramework
  Reason: image not found
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten.rb:51:in `run_sourcekitten': Running `/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten doc` failed:  (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/doc_builder.rb:55:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/bin/jazzy:15:in `<top (required)>'
    from /usr/bin/jazzy:23:in `load'
    from /usr/bin/jazzy:23:in `<main>'

@beltex
Copy link
Contributor

beltex commented Feb 8, 2015

@AliSoftware As I understand it, libclang.dylib is sourced from your Xcode install, and it's expected to be at /Applications/Xcode.app/... You can check yours via xcode-select -p

Here's the solution to that via symlinks (preferred solution, as it will persist even if a new version of jazzy is installed). Or alternatively, you can add the rpath to your specific Xcode install to the binary as we did here previously, though this time its the SourceKittenFramework binary which is at <RUBY_GEM_PATH>/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/SourceKittenFramework.framework/

So it be

sudo install_name_tool -add_rpath "<PATH_TO_XCODE>/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib" SourceKittenFramework

Hope that helps! :)

@AliSoftware
Copy link

@beltex I'm ashamed not to have seen that one!

I was quite sure my Xcode was named Xcode.app but that's only the case on my work computer; on my personal computer, it was called Xcode6.app instead and that's indeed the reason it failed.
Once renamed (and xcode-select-ed), jazzy worked fine.

Thanks for your insight! 🎷

@beltex
Copy link
Contributor

beltex commented Feb 8, 2015

np! :)

@rodriguise
Copy link

I get this error too, and my Xcode is in the usual place. After the "patch" above I still get:

Failed to generate documentation
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten.rb:51:in run_sourcekitten': Running/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/sourcekitten/sourcekitten docfailed: (RuntimeError) from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/lib/jazzy/doc_builder.rb:55:inbuild'
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.0/bin/jazzy:15:in <top (required)>' from /usr/bin/jazzy:23:inload'
from /usr/bin/jazzy:23:in `

'

@segiddins
Copy link
Collaborator

@rodriguise your error is unrelated -- SourceKitten is running for you, but it's encountering an error along the way.

@beltex
Copy link
Contributor

beltex commented Feb 18, 2015

Same error still :(

Symlinks are there now, but some are not quite correct.

# Should link to '-> Versions/Current/SourceKittenFramework'
$ pwd
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/SourceKitten/SourceKittenFramework.framework
$ ls -l SourceKittenFramework.framework
lrwxr-xr-x  1 root  wheel  48 17 Feb 20:19 SourceKittenFramework.framework -> Versions/Current/SourceKittenFramework.framework

# Should link to '-> A'
$ cd Versions
$ ls -l Current
lrwxr-xr-x  1 root  wheel  10 17 Feb 20:19 Current -> Versions/A

@segiddins
Copy link
Collaborator

@beltex any chance you could submit a PR fixing this?

@jballands
Copy link

I'm still getting the same issue. Xcode 6.1.1, Jazzy 0.1.1:

dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /usr/local/lib/ruby/gems/2.2.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten/sourcekitten Reason: image not found /usr/local/lib/ruby/gems/2.2.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten.rb:51:in `run_sourcekitten': Running`/usr/local/lib/ruby/gems/2.2.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten/sourcekitten doc`failed: (RuntimeError) from /usr/local/lib/ruby/gems/2.2.0/gems/jazzy-0.1.1/lib/jazzy/doc_builder.rb:55:in`build' from /usr/local/lib/ruby/gems/2.2.0/gems/jazzy-0.1.1/bin/jazzy:15:in `' from /usr/local/bin/jazzy:23:in`load' from /usr/local/bin/jazzy:23:in `' /Users/ajballan/Documents/Work Stuff/Development/ReadyApp RT/docs/scripts

Post regarding the install_name_tool works, but latest version of Jazzy doesn't work out of the box.

@segiddins
Copy link
Collaborator

@jballands where do you have Xcode installed?

@jballands
Copy link

@segiddins /Applications/Xcode.app

@ghost
Copy link

ghost commented Feb 25, 2015

I can also confirm that this problem is still occuring.

@emaloney
Copy link

I was having this problem as well, and was able to resolve it by manually installing SourceKitten 0.3.1 directly from the .pkg file downloadable here.

Hope this helps!

@0xced
Copy link

0xced commented Feb 26, 2015

No need to use install_name_tool, just fixing the frameworks structure should be enough. For some reason, the frameworks installed inside the sourcekitten directory have a symbolic link for Current -> Versions/A instead of Current -> A.

Here is how to fix it:

$ cd /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
$ for framework in *.framework; do pushd "$framework/Versions" && sudo ln -fs A Current && popd; done
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten/Commandant.framework/Versions /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten/LlamaKit.framework/Versions /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten/SourceKittenFramework.framework/Versions /Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.1.1/lib/jazzy/sourcekitten

@beltex
Copy link
Contributor

beltex commented Feb 26, 2015

@segiddins Done! Let me know if it works for you.

And sorry about the late response, was held up with a few things.

@segiddins
Copy link
Collaborator

No worries :) I really appreciate the help.

@beltex
Copy link
Contributor

beltex commented Mar 1, 2015

Hi folks! The latest version of jazzy (0.1.2) should have this fixed. There still seems to be some issues nonetheless though - #170

If you can give it a shot and report back the result it would be most appreciated! :)

@ghost
Copy link

ghost commented Mar 3, 2015

I had a coworker run the latest version of jazzy and he said that he had no issues!

Thanks for everything.

@beltex
Copy link
Contributor

beltex commented Mar 3, 2015

@trishayy Awesome, thanks!

@pigeon-archive pigeon-archive modified the milestone: The Past Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests