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

Fix a issue that libclang.dylib won't be loaded when it is linked with libLLVM-3.5.dylib #65

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 17, 2014

When I try to use ycmd with homebrewed libclang where libclang.dylib is linked to libLLVM-3.5.dylib, the ycm_core.so won't load (error message: dyld: no suitable image found).

For macs, we can have multiple RPATHs. To my surprise, appending the dependent library's path to the ycm_core.so's rpath list just solves this issue.

BTW passing the argument -Wl,rpath,EXTRA_LIB_PATH to the compiler should produce the same effect as the command install_name_tool -add_rpath does.

@ghost ghost changed the title fix a issue that libclang.dylib won't be loaded when it is linked with libLLVM-3.5.dylib Fix a issue that libclang.dylib won't be loaded when it is linked with libLLVM-3.5.dylib Dec 17, 2014
@Valloric
Copy link
Member

Sorry, but this is extra complexity only to support a homebrewed setup that others are unlikely to have. This isn't worth maintaining long-term.

@Valloric Valloric closed this Dec 17, 2014
@ghost
Copy link
Author

ghost commented Dec 18, 2014

Well, if the clang+llvm is built from source with shared libraries enabled, libclang is linked with libLLVM(or a series of libLLVMXXX libraries if you are using cmake). We don't set correct rpath for ycm_core.so or don't set global environment variable DYLD_FALLBACK_LIBRARY_PATH for this situation, so the vim will fail to load YCM.

To be clear, I use several copies of clang+llvm (both prebuilt ones and self-built ones, homebrewed one is only one of them), and YCM won't work with any of them that are built with shared-libraries option on.

It is sad to see this fix not getting merged while it is a quite common situation for devs. I think the similar issue exists for the linux platform as well if we are using self-built clang+llvm or versions of clangs.

Thanks!

BTW: If you want to come back to deal with this issue, set up your environment variable DYLD_PRINT_RPATHS and this will save you a lot of debug time.

@ghost ghost deleted the fix_dynamically_linked_libclang branch December 18, 2014 02:47
@Valloric
Copy link
Member

You've convinced me to give this another chance. I'll need to test it out on my Mac at home when I have the time, but I'm now open to this merging.

@Valloric
Copy link
Member

BTW you've deleted the branch; you'll probably need to re-send the PR.

@ghost ghost restored the fix_dynamically_linked_libclang branch December 19, 2014 02:12
@ghost ghost deleted the fix_dynamically_linked_libclang branch December 19, 2014 02:12
@ghost ghost restored the fix_dynamically_linked_libclang branch December 19, 2014 02:12
@ghost
Copy link
Author

ghost commented Dec 19, 2014

Yeah, I opened a new PR in #66

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

Successfully merging this pull request may close these issues.

None yet

1 participant