Giter Club home page Giter Club logo

node-ffi-generate's Introduction

npm install -g ffi-generate

Generate FFI Bindings

ffi-generate -f /path/to/myLibrary/header.h -l libmyLibrary

Will parse the given filename and print to standard out the resulting javascript suitable for use as a module.

  • f -- required -- The header file you wish to parse
  • l -- required -- The library FFI will use to dlopen
  • m -- optional -- The module name underwhich functions will be stored (uses library name otherwise)
  • p -- optional -- Only include functions whose name starts with the provided prefix
  • you can specify multiple -p on the command line to get multiple prefixes
  • x -- optional -- Restrict to only functions declared in the given header file
  • s -- optional -- Use StrictType type wrapper (experimental)
  • L -- optional -- If libclang.{so,dylib} is in a non-standard path use this which will rerun the process with [DY]LD_LIBRARY_PATH set

It may be necessary to pass additional flags to libclang so it can better parse the header (i.e. include paths). To pass options directly to libclang use -- so ffi-generate-node knows to stop parsing arguments, the rest will be passed to libclang without modification.

ffi-generate -f /usr/include/ImageMagick/wand/MagickWand.h -l libMagickWand -m wand -p Magick -- $(Magick-config --cflags)

Generate FFI Bindings Programatically

var exec = require('child_process').exec;
var path = require('path');
var fs = require('fs');
var jsb = require('beautifyjs');
var generate = require('lib/generateffi').generate;

exec('llvm-config --includedir', function (fail, out, err) {
  var includedir = out.replace(/\s+$/, '');
  var result = exports.generate({
    filename: path.join(includedir, 'clang-c', 'Index.h'),
    library: 'libclang',
    prefix: 'clang_', 
    includes: [includedir],
  });

  if (result.unmapped.length > 0) {
    console.log('----- UNMAPPED FUNCTIONS -----');
    console.log(result.unmapped);
    console.log('----- UNMAPPED FUNCTIONS -----');
  }

  fs.writeFileSync(path.join(__dirname, 'dynamic_clang.js'), jsb.js_beautify(result.serialized));
  var dynamic_clang = require(path.join(__dirname, 'dynamic_clang'));
  var ver = dynamic_clang.libclang.clang_getClangVersion();
  console.log(dynamic_clang.libclang.clang_getCString(ver));
  dynamic_clang.libclang.clang_disposeString(ver)
});

Input to the generate method

  • opts.filename -- required -- the full path to the header source file to parse
  • opts.library -- required -- the library ffi should use to dlopen
  • opts.module -- optional -- the name of the module that will be exported (otherwise uses library name)
  • opts.prefix -- optional -- restrict imported functions to a given prefix
  • opts.includes -- optional -- a set of directory paths to aid type expansion
  • opts.compiler_args -- optional -- a set of clang command line options passed to the parser
  • opts.single_file -- optional -- restricts functions to only those defined in the header file
    • this does not restrict dependent types

The result from generate is an object that has two properties

  • serialized - a string representation of the bindings suitable for writing to file
  • unmapped - a set of functions that failed to map -- most likely from failure to map a type to ffi type.
  • each element is an object with following properties
  • position - -1 means the return type, otherwise the argument
  • arg - name of the type that failed to map
  • name - the name of the function that failed
  • decl - the signature of the function that failed

node-ffi-generate's People

Contributors

tjfontaine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-ffi-generate's Issues

Update clang to version 3.7+

libclang version 3.2 is not available for 64 bit windows. There is only an experimental version for 32 bit windows. Trying to use this gives win32 error 193. This seems to be the reason that windows users are complaining that they're getting the message "Unable to load libclang, make sure you have 3.2 installed...". The earliest version of clang that supports 64 bit windows is version 3.7.

The master branch and v0.0.8 tag have diverged

The package version on master (currently commit 5ad34dc) is v0.0.7, while the published version on npm is v0.0.8.

  • The v0.0.8 tag has additional MIT license information, but no functional changes.
  • The master branch has functional changes, but not the MIT license information.

While it's been years, perhaps it'd be best to fix this before a new release.

See

No structs or #defined constants

I'm trying to build FFI defs for nanomsg, but I don't get any struct defs or #define constants, am I meant to be passing magic libclang flags or something?

Maximum call stack size exceeded

Error: Maximum call stack size exceeded
    at disabled (/Users/gracjan/Sources/node-mupdf/node_modules/debug/debug.js:65:20)
    at new StructType (/Users/gracjan/Sources/node-mupdf/node_modules/ref-struct/lib/struct.js:83:7)
    at Function.get (/Users/gracjan/Sources/node-mupdf/node_modules/ref-struct/lib/struct.js:156:10)
    at Object.get (/Users/gracjan/Sources/node-mupdf/node_modules/ref/lib/ref.js:447:17)
    at Object.deref (/Users/gracjan/Sources/node-mupdf/node_modules/ref/lib/ref.js:655:18)
    at Buffer.deref (/Users/gracjan/Sources/node-mupdf/node_modules/ref/lib/ref.js:1259:18)
    at /Users/gracjan/Sources/node-mupdf/node_modules/ffi/lib/callback.js:62:26
    at Object.ForeignFunction.proxy [as clang_visitChildren] (/Users/gracjan/Sources/node-mupdf/node_modules/ffi/lib/_foreign_function.js:59:14)
    at Cursor.visitChildren (/Users/gracjan/Sources/node-mupdf/node_modules/libclang/lib/cursor.js:153:7)
    at defineType (/Users/gracjan/Sources/node-mupdf/node_modules/ffi-generate/lib/generateffi.js:140:10)

I have no clue how to debug this further.

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

bunch of binding errors

npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! binding.cc
npm ERR! C:\Users\Matt\AppData\Roaming\npm\node_modules\ffi-generate\node_modules\ref\src\binding.cc(222,43): error C2660: 'v8::Value::BooleanValue': function does not take 0 arguments [C:\Users\Matt\AppData\Roaming\npm\node_modules\ffi-generate\node_modules\ref\build\binding.vcxproj]

and the list goes on and on with V8 errors

unable to load clang on windows

Despite using the -L option with full path of libclang.dll (and its container folder) it is failing to recognize the clang on Windows.

安装模块的时候报错了

’yarn global add ffi-generate‘ and ’yarn global add libclang‘

ERROR INFO
error /usr/local/share/.config/yarn/global/node_modules/ref: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /usr/local/share/.config/yarn/global/node_modules/ref Output: gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | linux | x64 gyp info find Python using Python version 2.7.5 found at "/usr/bin/python" gyp info spawn /usr/bin/python gyp info spawn args [ gyp info spawn args '/root/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/usr/local/share/.config/yarn/global/node_modules/ref/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.cache/node-gyp/12.18.0/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/12.18.0', gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/12.18.0/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/usr/local/share/.config/yarn/global/node_modules/ref', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] make: Entering directory /usr/local/share/.config/yarn/global/node_modules/ref/build'
gyp info spawn make
CXX(target) Release/obj.target/binding/src/binding.o
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
../src/binding.cc:17:0: warning: "STDC_FORMAT_MACROS" redefined [enabled by default]
#define STDC_FORMAT_MACROS
^
:0:0: note: this is the location of the previous definition
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::WriteObject(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:222:43: error: no matching function for call to ‘v8::Value::BooleanValue()’
bool persistent = info[3]->BooleanValue();
^
../src/binding.cc:222:43: note: candidates are:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2699:8: note: bool v8::Value::BooleanValue(v8::Isolate*) const
bool BooleanValue(Isolate* isolate) const;
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2699:8: note: candidate expects 1 argument, 0 provided
In file included from /root/.cache/node-gyp/12.18.0/include/node/v8-internal.h:14:0,
from /root/.cache/node-gyp/12.18.0/include/node/v8.h:27,
from /root/.cache/node-gyp/12.18.0/include/node/node.h:67,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2702:51: note: v8::Maybe v8::Value::BooleanValue(v8::Localv8::Context) const
V8_WARN_UNUSED_RESULT Maybe BooleanValue(
^
/root/.cache/node-gyp/12.18.0/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2702:51: note: candidate expects 1 argument, 0 provided
V8_WARN_UNUSED_RESULT Maybe BooleanValue(
^
/root/.cache/node-gyp/12.18.0/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::ReadPointer(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:253:38: error: no matching function for call to ‘v8::Value::Uint32Value()’
size_t size = info[2]->Uint32Value();
^
../src/binding.cc:253:38: note: candidate is:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: v8::Maybe v8::Value::Uint32Value(v8::Localv8::Context) const
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: candidate expects 1 argument, 0 provided
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::WriteInt64(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:360:30: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::Value&)’
String::Utf8Value str(in);
^
../src/binding.cc:360:30: note: candidate is:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:3135:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:3135:5: note: candidate expects 2 arguments, 1 provided
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::WriteUInt64(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:447:30: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::Value&)’
String::Utf8Value str(in);
^
../src/binding.cc:447:30: note: candidate is:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:3135:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:3135:5: note: candidate expects 2 arguments, 1 provided
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::ReinterpretBuffer(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:521:38: error: no matching function for call to ‘v8::Value::Uint32Value()’
size_t size = info[1]->Uint32Value();
^
../src/binding.cc:521:38: note: candidate is:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: v8::Maybe v8::Value::Uint32Value(v8::Localv8::Context) const
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: candidate expects 1 argument, 0 provided
../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::ReinterpretBufferUntilZeros(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cc:550:44: error: no matching function for call to ‘v8::Value::Uint32Value()’
uint32_t numZeros = info[1]->Uint32Value();
^
../src/binding.cc:550:44: note: candidate is:
In file included from /root/.cache/node-gyp/12.18.0/include/node/node.h:67:0,
from ../src/binding.cc:5:
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: v8::Maybe v8::Value::Uint32Value(v8::Localv8::Context) const
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
^
/root/.cache/node-gyp/12.18.0/include/node/v8.h:2707:41: note: candidate expects 1 argument, 0 provided
../src/binding.cc: In function ‘void init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:582:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(int8, int8_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:583:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uint8, uint8_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:584:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(int16, int16_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:585:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uint16, uint16_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:586:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(int32, int32_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:587:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uint32, uint32_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:588:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(int64, int64_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:589:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uint64, uint64_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:590:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(float, float);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:591:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(double, double);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:593:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(bool, bool);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:594:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(byte, unsigned char);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:595:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(char, char);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:596:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uchar, unsigned char);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:597:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(short, short);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:598:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(ushort, unsigned short);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:599:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(int, int);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:600:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(uint, unsigned int);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:601:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(long, long);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:602:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(ulong, unsigned long);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:603:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(longlong, long long);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:604:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(ulonglong, unsigned long long);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:605:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(pointer, char *);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:606:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(size_t, size_t);
^
../src/binding.cc:581:118: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
smap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(sizeof(type))));
^
../src/binding.cc:608:3: note: in expansion of macro ‘SET_SIZEOF’
SET_SIZEOF(Object, Nan::Persistent);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:615:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(int8, int8_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:616:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uint8, uint8_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:617:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(int16, int16_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:618:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uint16, uint16_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:619:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(int32, int32_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s##name))));
^
../src/binding.cc:620:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uint32, uint32_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:621:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(int64, int64_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:622:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uint64, uint64_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:623:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(float, float);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:624:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(double, double);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:625:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(bool, bool);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:626:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(char, char);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:627:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uchar, unsigned char);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:628:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(short, short);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:629:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(ushort, unsigned short);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:630:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(int, int);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:631:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(uint, unsigned int);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:632:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(long, long);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:633:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(ulong, unsigned long);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:634:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(longlong, long long);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:635:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(ulonglong, unsigned long long);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:636:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(pointer, char *);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:637:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(size_t, size_t);
^
../src/binding.cc:614:134: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
amap->Set(Nan::Newv8::String( #name ).ToLocalChecked(), Nan::Newv8::Uint32(static_cast<uint32_t>(alignof(struct s_##name))));
^
../src/binding.cc:638:3: note: in expansion of macro ‘SET_ALIGNOF’
SET_ALIGNOF(Object, Nan::Persistent);
^
../src/binding.cc:641:68: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
target->Set(Nan::Newv8::String("sizeof").ToLocalChecked(), smap);
^
../src/binding.cc:642:69: warning: ‘bool v8::Object::Set(v8::Localv8::Value, v8::Localv8::Value)’ is deprecated (declared at /root/.cache/node-gyp/12.18.0/include/node/v8.h:3498): Use maybe version [-Wdeprecated-declarations]
target->Set(Nan::Newv8::String("alignof").ToLocalChecked(), amap);
^
../src/binding.cc:643:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Value, v8::PropertyAttribute)’ is deprecated (declared at ../../nan/nan_maybe_43_inl.h:117) [-Wdeprecated-declarations]
Nan::ForceSet(target, Nan::Newv8::String("endianness").ToLocalChecked(), Nan::Newv8::String(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete));
^
../src/binding.cc:643:187: warning: ‘Nan::Maybe Nan::ForceSet(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Value, v8::PropertyAttribute)’ is deprecated (declared at ../../nan/nan_maybe_43_inl.h:117) [-Wdeprecated-declarations]
Nan::ForceSet(target, Nan::Newv8::String("endianness").ToLocalChecked(), Nan::Newv8::String(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete));
^
../src/binding.cc:644:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Value, v8::PropertyAttribute)’ is deprecated (declared at ../../nan/nan_maybe_43_inl.h:117) [-Wdeprecated-declarations]
Nan::ForceSet(target, Nan::Newv8::String("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete));
^
../src/binding.cc:644:142: warning: ‘Nan::Maybe Nan::ForceSet(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Value, v8::PropertyAttribute)’ is deprecated (declared at ../../nan/nan_maybe_43_inl.h:117) [-Wdeprecated-declarations]
Nan::ForceSet(target, Nan::Newv8::String("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete));
^
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory /usr/local/share/.config/yarn/global/node_modules/ref/build' gyp ERR! build error gyp ERR! stack Error: makefailed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/root/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Linux 3.10.0-1127.el7.x86_64 gyp ERR! command "/root/.nvm/versions/node/v12.18.0/bin/node" "/root/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/share/.config/yarn/global/node_modules/ref gyp ERR! node -v v12.18.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok

Can't load libclang on Debian

I got ffi-generate working on my laptop with OS X. It was a bit of a pain, but I was able to confirm that it worked. Now, when I try to do it in Debian I can't for the life of me get it working. I keep getting the "Unable to load libclang, make sure you have 3.2 installed, either specify -L or have llvm-config in your path" error. I would really appreciate some guidance on this. Alternatively, can you update ffi-generate where it downloads libclang automatically so it knows where to find it?

Please respond!

CJ

Generates invalid syntax

When trying to generate FFI bindings for libfuse:

> 50 | types.["fuse_args"] = fuse_args;
     |       ^
  51 | types.["fuse_opt_proc_t"] = fuse_opt_proc_t;
  52 | types.["js_CString"] = js_CString;
  53 | types.["js_int32"] = js_int32;
    at p (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:22:1038)
    at d (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:22:1271)
    at Object.parse (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:27:50335)
    at Object.parse (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:7361:23)
    at coreFormat (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:8672:18)
    at formatWithCursor2 (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:8864:18)
    at /src/qix-/test-fuse-ffi/node_modules/prettier/index.js:39174:12
    at Object.format (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:39188:12)
    at generate (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/lib/generate.js:53:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runGenerator (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:132:20)
    at async loadAndGenerate (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:160:3)
    at async mainAsync (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:166:3) {
  loc: { start: { line: 50, column: 7 } },
  codeFrame: '  48 | ;\n' +
    '  49 |\n' +
    '> 50 | types.["fuse_args"] = fuse_args;\n' +
    '     |       ^\n' +
    '  51 | types.["fuse_opt_proc_t"] = fuse_opt_proc_t;\n' +
    '  52 | types.["js_CString"] = js_CString;\n' +
    '  53 | types.["js_int32"] = js_int32;'

Looks like it's incorrectly trying to do 'types.' + name or something, where name == '["fuse_args"]' or something.

cc @joelpurra

Issue with arrays of structs inside other structs

Here's a reproducible example:

test.h:

typedef struct fooStruct_
{
    int bar;
} fooStruct;

typedef struct bazStruct_
{
    fooStruct  foos[2];
} bazStruct;

void someFunc(bazStruct* baz);

ffi-generate -f test.h -l foo > foo.js

foo.js:

var FFI = require('ffi'),
    ArrayType = require('ref-array'),
    Struct = require('ref-struct'),
    ref = require('ref');

var voidPtr = ref.refType(ref.types.void);

exports.CONSTANTS = {
};

var fooStruct_ = exports.fooStruct_ = ArrayType(fooStruct_, 2); // this seems broken to me
var fooStruct_Ptr = exports.fooStruct_Ptr = ref.refType(fooStruct_);
var bazStruct = exports.bazStruct = Struct({
  foos: fooStruct_,
});
var bazStructPtr = exports.bazStructPtr = ref.refType(bazStruct);

exports.foo = new FFI.Library('foo', {
  someFunc: [ref.types.void, [
    bazStructPtr,
  ]],
});

node foo.js:

assert.js:92
  throw new assert.AssertionError({
        ^
AssertionError: could not determine a proper "type" from: undefined
    at Object.coerceType (/home/rye/Downloads/OculusSDK/LibOVR/Src/node_modules/ref/lib/ref.js:389:3)
    at Array (/home/rye/Downloads/OculusSDK/LibOVR/Src/node_modules/ref-array/lib/array.js:20:19)
    at Object.<anonymous> (/home/rye/Downloads/OculusSDK/LibOVR/Src/foo.js:11:39)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

How to set the path of Class

I have a .h file like this

#pragma once 

class  __declspec(dllexport) Person
{
private:
	int age;
public:
	int getAge();
	void setAge(int a);
};

I used this tool to generate it to me like this

var FFI = require('ffi'),
    ArrayType = require('ref-array'),
    Struct = require('ref-struct'),
    ref = require('ref');

var voidPtr = ref.refType(ref.types.void);

exports.CONSTANTS = {
};


exports.libmyLibrary = new FFI.Library('libmyLibrary', {
});

I want to know how to refer to classes and classes that contain a class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.