node-ffi-generate icon indicating copy to clipboard operation
node-ffi-generate copied to clipboard

Unable to load libclang

Open amitpanghal opened this issue 10 years ago • 10 comments

I have installed node-ffi-generate on my system for genrating bindings of a dll providing the header file and the library but it throws following error :- "Unable to load libclang, make sure you have 3.2 installed, either specify -L or have llvm-config in your path"

My command is > ffi-generate -f PremiereSoftphone.h -l SoftphoneLib.dll

amitpanghal avatar Dec 02 '14 06:12 amitpanghal

I am currently having the same problem. Is 3.2 specifically required or will 3.4 or 3.5 work?

zrichmond avatar Dec 15 '14 22:12 zrichmond

Installing libclang locally instead of globally worked for me: npm install libclang

zrichmond avatar Dec 16 '14 18:12 zrichmond

I have the same problem.

lygstate avatar Feb 11 '15 08:02 lygstate

Same here.

mping avatar Mar 29 '15 19:03 mping

I managed to get this working by doing the following... I have no idea which part of it actually fixed it lol.

cd into my node_modules/ffi-generate and npm install libclang

Then run

ffi-generate.js -f /usr/local/Cellar/libgphoto2/2.5.5/include/gphoto2/gphoto2.h -l libgphoto2 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/

Where /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ is where my libclang.dylib is located

dubcanada avatar May 05 '15 20:05 dubcanada

Same issue here, no fix?

basickarl avatar May 15 '17 12:05 basickarl

I did

sudo apt-get install libclang-3.8-dev Then:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/llvm-3.8/lib/"

basickarl avatar May 15 '17 13:05 basickarl

same issue (windows 7 x64)

sincerefly avatar Apr 10 '18 02:04 sincerefly

@dubcanada Your solution works indeed :) thanks.

VishwasShashidhar avatar Jul 25 '18 09:07 VishwasShashidhar

Hello guys, you need just specify path to your libclang.so :

// I have already tested versions from 3.6 to 6 and they provide same output
// except version 7 which brakes it down.
// So the maximum supporting version is libclang-6.0-dev
sudo apt install libclang-6.0-dev

// then find location if you don't know where it's located
sudo find /usr/ -name "libclang.so"

// specify path  -L /usr/lib/llvm-6.0/lib/ (but with your path) like @dubcanada did
// or clearly variant --libclang /usr/lib/llvm-6.0/lib/
ffi-generate -f PremiereSoftphone.h -l SoftphoneLib.dll --libclang /usr/lib/llvm-6.0/lib/

Always use ffi-generate command with libclang path option.

You don't need to install libclang package to ffi-generate dir like other mentioned above.

Also, you can get rid of globally installed ffi-generate by installing it locally then launch like this npx ffi-generate and npx( shipped by default with npm) will find it locally.

noth8 avatar Jun 27 '19 15:06 noth8