Home Download Buy Blog Forum Support

clang (C/C++/Objective-C/Objective-C++) autocomplete

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby zaibon on Mon Jan 09, 2012 9:48 pm

Hi !

I can't get to work sublimClang.
I've followed the tuto for the libclang.so and copy it in the root directory of the package, put I get the error message :

Code: Select all
"It looks like libclang.so couldn't be loaded. On Linux you have to compile it yourself, or install it via your package manager. Please note that this plugin uses features from clang 3.0 so make sure that is the version you have installed.

Once installed, you need to copy libclang.so into the root of this plugin. See http://github.com/quarnster/SublimeClang for more details."


I'm runnig sabayon. I'have clang3.0 installed and I get the .so from "/usr/lib/llvm/libclang.so"

any idée? thanks
zaibon
 
Posts: 4
Joined: Mon Jan 09, 2012 9:32 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Mon Jan 09, 2012 9:55 pm

Try putting it in /usr/lib/
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby zaibon on Mon Jan 09, 2012 10:11 pm

same problem
zaibon
 
Posts: 4
Joined: Mon Jan 09, 2012 9:32 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Mon Jan 09, 2012 10:24 pm

What's printed in the sublime console?
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby zaibon on Mon Jan 09, 2012 10:28 pm

Code: Select all
Reloading plugin /home/zaibon/.config/sublime-text-2/Packages/SublimeClang/errormarkers.py
Reloading plugin /home/zaibon/.config/sublime-text-2/Packages/SublimeClang/sublimeclang.py
Traceback (most recent call last):
  File "./clang/cindex.py", line 117, in get_cindex_library
    return cdll.LoadLibrary("libclang.so")
  File "/opt/SublimeText2/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/opt/SublimeText2/lib/python2.6/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libLLVM-3.0.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
error: It looks like libclang.so couldn't be loaded. On Linux you have to compile it yourself, or install it via your package manager. Please note that this plugin uses features from clang 3.0 so make sure that is the version you have installed.

Once installed, you need to copy libclang.so into the root of this plugin. See http://github.com/quarnster/SublimeClang for more details.

Traceback (most recent call last):
  File "./sublime_plugin.py", line 57, in reload_plugin
  File "./sublimeclang.py", line 33, in <module>
    from clang import cindex
  File "./clang/cindex.py", line 1233, in <module>
    _clang_getNumDiagnostics = lib.clang_getNumDiagnostics
AttributeError: 'NoneType' object has no attribute 'clang_getNumDiagnostics'
found 9 files for base name Default.sublime-keymap
found 6 files for base name Main.sublime-menu
theme loaded
zaibon
 
Posts: 4
Joined: Mon Jan 09, 2012 9:32 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Mon Jan 09, 2012 10:32 pm

My french is rusty, but it looks like your libclang.so depends on libLLVM-3.0.so. Try putting that file in /usr/lib also and repeat as needed until there is no more ".so" files listed in an error message like that.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby zaibon on Mon Jan 09, 2012 10:39 pm

Fixed !

copying "/usr/lib/llvm/libLLVM-3.0.so" into the root directory of the Package did the trick !

thanks for your work ! Now I can fully switch to SublimText.
zaibon
 
Posts: 4
Joined: Mon Jan 09, 2012 9:32 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Mon Jan 09, 2012 10:52 pm

Cool, I've updated the readme with information on libLLVM-3.0.so for other users if they run into this problem, thanks for letting me know
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby freewizard on Tue Jan 10, 2012 10:36 am

The plugin is wonderful!
Finally get this plugin working for Objective C project with the following change to the options: ( you might want to change some of the path to fit your sdk/project )
Code: Select all
    "add_language_option": false, // I set this to false and added -ObjC so that .h file will be parsed as Objective-C even when the syntax selected as c/c++; alternative choice is to force all .h open as Objective-C

    // Any options you want to give to clang
    "options":
    [
        "-Wall",
        "-ObjC",
        "-fexceptions",
        "-fasm-blocks",
        "-mmacosx-version-min=10.6",
        "-gdwarf-2",
        "-Wno-sign-conversion",
        "-fobjc-abi-version=2",
        "-fobjc-legacy-dispatch",
        "-D__IPHONE_OS_VERSION_MIN_REQUIRED=30000",
        "-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk",
        "-F/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks",
        "-I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include",
        "-I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/libxml2",
        "-I/MyCode/Interface",
        "-I/MyCode/Core",
        "-I/MyCode/Headers"
    ]


A wish list (no pressing):
* parsing configuration on per project basis, currently it seems not possible as the plugin load setting by sublime.load_settings(), maybe consider read it from view.settings() as well?
* showing a "syntax error" indicate for the view on the status bar (view.set_status("clang", "Clang: Syntax Error"))
* command to navigate through error positions
* option to show error panel only when check after saved ( a bit annoy when it keeps show up when writing code )
using Sublime Text 3 dev in OS X 10.8
my ST packages: https://github.com/freewizard
freewizard
 
Posts: 36
Joined: Wed Feb 09, 2011 4:14 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Tue Jan 10, 2012 11:04 am

Thanks for the suggestions, I've opened up feature request issues on the project page so that I don't forget about them.

If any one else suggested something and it's not implemented already, please let me know or file a feature request issue for that yourself.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests