tjfontaine / node-libclang

nodejs bindings for libclang
MIT License
52 stars 27 forks source link

Which version of clang? #2

Closed olalonde closed 1 year ago

olalonde commented 12 years ago

I'm trying to use this on OS X 10.7.2 and getting the following error:

Error: Dynamic Symbol Retrieval Error: dlsym(0x100d00220, clang_CXIndex_setGlobalOptions): symbol not found

I assume this was tested on a different version of libclang? Which one did you use? Maybe it would be a good idea to version the library in the repo?

tjfontaine commented 12 years ago

I found it quickest to use http://www.llvm.org/releases/download.html#3.1 which I extracted into ~/.llvm and generally run in a shell that has

export DYLD_LIBRARY_PATH=$HOME/.llvm/lib
export PATH=$HOME/.llvm/bin:$PATH
tjfontaine commented 12 years ago

I do some versioning checking in my other bootstrapped libraries, I'll add that to this I guess

stanleygu commented 12 years ago

I ran into this same error, even after using export PATH=$HOME/.llvm/bin:$PATH. This is using version 3.1 of the clang binaries.

olalonde commented 12 years ago

You're on Linux right? I think on Linux the environment variable should be LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$HOME/.llvm/lib
stanleygu commented 12 years ago

I am running Linux and I believe this line fixed the problem of linking to libclang.so. However, now there is an issue as above in running bin/clang. I ran export PATH=$HOME/.llvm/bin:$PATH so I think the binary should be found but perhaps it's a version issue. On Nov 6, 2012 12:39 AM, "Olivier Lalonde" notifications@github.com wrote:

You're on Linux right? I think on Linux the environment variable should be LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$HOME/.llvm/lib

— Reply to this email directly or view it on GitHubhttps://github.com/tjfontaine/node-libclang/issues/2#issuecomment-10102894.

tjfontaine commented 12 years ago

@stanley-gu what exactly is the error you're seeing?

stanleygu commented 12 years ago

This is the error I am getting:

node_modules/ffi/lib/dynamic_library.js:112                                                                                    
    throw new Error('Dynamic Symbol Retrieval Error: ' + this.error())                                                                                                                                   
          ^                                                                                                                                                                                              
Error: Dynamic Symbol Retrieval Error: /var/lib/stickshift/2a0323c33ed84890a6c16eada00de882/app-root/data/llvm/lib/libclang.so: undefined symbol: clang_CXIndex_setGlobalOptions                         
    at DynamicLibrary.get (/var/lib/stickshift/2a0323c33ed84890a6c16eada00de882/app-root/data/268889/node_modules/ffi/lib/dynamic_library.js:112:11)                                                     
    at /var/lib/stickshift/2a0323c33ed84890a6c16eada00de882/app-root/data/268889/node_modules/ffi/lib/library.js:48:19                                                                                   
    at Array.forEach (native)                                                                                                                                                                            
    at new Library (/var/lib/stickshift/2a0323c33ed84890a6c16eada00de882/app-root/data/268889/node_modules/ffi/lib/library.js:45:28)                                                                     
    at Object.<anonymous> (/var/lib/stickshift/2a0323c33ed84890a6c16eada00de882/app-root/data/268889/node_modules/libclang/lib/dynamic_clang.js:835:20)                                                  
    at Module._compile (module.js:446:26)                                                                                                                                                                
    at Object..js (module.js:464:10)                                                                                                                                                                     
    at Module.load (module.js:353:31)                                                                                                                                                                    
    at Function._load (module.js:311:12)                                                                                                                                                                 
    at Module.require (module.js:359:17)  
stanleygu commented 12 years ago

I figured it out, I was using llvm version 2.9 and not 3.1.