node-ffi-generate
node-ffi-generate copied to clipboard
Unable to load libclang
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
I am currently having the same problem. Is 3.2 specifically required or will 3.4 or 3.5 work?
Installing libclang locally instead of globally worked for me:
npm install libclang
I have the same problem.
Same here.
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
Same issue here, no fix?
I did
sudo apt-get install libclang-3.8-dev
Then:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/llvm-3.8/lib/"
same issue (windows 7 x64)
@dubcanada Your solution works indeed :) thanks.
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.