f3lang / node-rsvg-prebuilt

Parse SVG files and render them as PNG, PDF, SVG, or raw memory buffer images.
MIT License
15 stars 6 forks source link

support node 12 & electron 5 #11

Open f3lang opened 5 years ago

f3lang commented 5 years ago

Waiting for lgeiger/node-abi/pull/62

LinusU commented 5 years ago

Seems to be merged now, any chance we could get this moving? Anything I can do to help? ☺️

vitalymak commented 4 years ago

Any updates here?

physikerwelt commented 4 years ago

I can not compile with node 12 or newer. The warnings about v8 bindings, such as

https://github.com/f3lang/node-rsvg-prebuilt/blob/142bb99c7e30a5080debbf73c53b80e5ebd19696/src/Rsvg.h#L13

are now errors

> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://f3lang.s3.eu-central-1.amazonaws.com/librsvg/librsvg-prebuilt-v0.7.10-node-v72-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for librsvg-prebuilt@0.7.10 and node@12.16.1 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build'
  CXX(target) Release/obj.target/rsvg/src/Rsvg.o
In file included from ../src/Rsvg.cc:1:0:
../src/Rsvg.h:13:26: error: ‘v8::Handle’ has not been declared
     static void Init(v8::Handle<v8::Object> exports);
                          ^~~~~~
../src/Rsvg.h:13:32: error: expected ‘,’ or ‘...’ before ‘<’ token
     static void Init(v8::Handle<v8::Object> exports);
                                ^
In file included from ../src/Rsvg.cc:3:0:
../src/Enums.h:20:5: error: ‘Handle’ in namespace ‘v8’ does not name a template type
 v8::Handle<v8::Value> RenderFormatToString(render_format_t format);
     ^~~~~~
../src/Enums.h:22:5: error: ‘Handle’ in namespace ‘v8’ does not name a template type
 v8::Handle<v8::Value> CairoFormatToString(cairo_format_t format);
     ^~~~~~
In file included from ../src/Rsvg.h:8:0,
                 from ../src/Rsvg.cc:1:
../src/Rsvg.cc:38:17: error: prototype for ‘void Rsvg::Init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ does not match any in class ‘Rsvg’
 NAN_MODULE_INIT(Rsvg::Init) {
                 ^
../../nan/nan.h:155:10: note: in definition of macro ‘NAN_MODULE_INIT’
     void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target)
          ^~~~
In file included from ../src/Rsvg.cc:1:0:
../src/Rsvg.h:13:17: error: candidate is: static void Rsvg::Init(int)
     static void Init(v8::Handle<v8::Object> exports);
                 ^~~~
../src/Rsvg.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Rsvg::GetDPI(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Rsvg.cc:135:5: error: ‘Handle’ was not declared in this scope
     Handle<ObjectTemplate> dpi = Nan::New<ObjectTemplate>();
     ^~~~~~
../src/Rsvg.cc:135:5: note: suggested alternative: ‘handle’
     Handle<ObjectTemplate> dpi = Nan::New<ObjectTemplate>();
     ^~~~~~
     handle
../src/Rsvg.cc:135:26: error: expected primary-expression before ‘>’ token
     Handle<ObjectTemplate> dpi = Nan::New<ObjectTemplate>();
                          ^
../src/Rsvg.cc:135:28: error: ‘dpi’ was not declared in this scope
     Handle<ObjectTemplate> dpi = Nan::New<ObjectTemplate>();
                            ^~~
../src/Rsvg.cc:135:28: note: suggested alternative: ‘dpiY’
     Handle<ObjectTemplate> dpi = Nan::New<ObjectTemplate>();
                            ^~~
                            dpiY
../src/Rsvg.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Rsvg::SetDPI(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Rsvg.cc:146:40: error: no matching function for call to ‘v8::Value::NumberValue()’
     gdouble x = ARGVAR[0]->NumberValue();
                                        ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note: candidate: v8::Maybe<double> v8::Value::NumberValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
                                       ^~~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note:   candidate expects 1 argument, 0 provided
../src/Rsvg.cc:153:36: error: no matching function for call to ‘v8::Value::NumberValue()’
         y = ARGVAR[1]->NumberValue();
                                    ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note: candidate: v8::Maybe<double> v8::Value::NumberValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
                                       ^~~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note:   candidate expects 1 argument, 0 provided
../src/Rsvg.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Rsvg::Dimensions(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Rsvg.cc:239:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     String::Utf8Value idArg(ARGVAR[0]);
                                      ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
../src/Rsvg.cc:255:9: error: ‘Handle’ was not declared in this scope
         Handle<ObjectTemplate> dimensions = Nan::New<ObjectTemplate>();
         ^~~~~~
../src/Rsvg.cc:255:9: note: suggested alternative: ‘handle’
         Handle<ObjectTemplate> dimensions = Nan::New<ObjectTemplate>();
         ^~~~~~
         handle
../src/Rsvg.cc:255:30: error: expected primary-expression before ‘>’ token
         Handle<ObjectTemplate> dimensions = Nan::New<ObjectTemplate>();
                              ^
../src/Rsvg.cc:255:32: error: ‘dimensions’ was not declared in this scope
         Handle<ObjectTemplate> dimensions = Nan::New<ObjectTemplate>();
                                ^~~~~~~~~~
../src/Rsvg.cc:255:32: note: suggested alternative: ‘Dimensions’
         Handle<ObjectTemplate> dimensions = Nan::New<ObjectTemplate>();
                                ^~~~~~~~~~
                                Dimensions
../src/Rsvg.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Rsvg::HasElement(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Rsvg.cc:275:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     String::Utf8Value idArg(ARGVAR[0]);
                                      ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
../src/Rsvg.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Rsvg::Render(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Rsvg.cc:292:39: error: no matching function for call to ‘v8::Value::Int32Value()’
     int width = ARGVAR[0]->Int32Value();
                                       ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
../src/Rsvg.cc:293:40: error: no matching function for call to ‘v8::Value::Int32Value()’
     int height = ARGVAR[1]->Int32Value();
                                        ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
../src/Rsvg.cc:304:42: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     String::Utf8Value formatArg(ARGVAR[2]);
                                          ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
../src/Rsvg.cc:331:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     String::Utf8Value idArg(ARGVAR[3]);
                                      ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
../src/Rsvg.cc:442:5: error: ‘Handle’ was not declared in this scope
     Handle<ObjectTemplate> image = CREATE_OBJ();
     ^~~~~~
../src/Rsvg.cc:442:5: note: suggested alternative: ‘handle’
     Handle<ObjectTemplate> image = CREATE_OBJ();
     ^~~~~~
     handle
../src/Rsvg.cc:442:26: error: expected primary-expression before ‘>’ token
     Handle<ObjectTemplate> image = CREATE_OBJ();
                          ^
../src/Rsvg.cc:442:28: error: ‘image’ was not declared in this scope
     Handle<ObjectTemplate> image = CREATE_OBJ();
                            ^~~~~
In file included from ../src/Enums.h:7:0,
                 from ../src/Rsvg.cc:3:
../src/Rsvg.cc:453:31: error: ‘RenderFormatToString’ was not declared in this scope
     PROP_SET(image, "format", RenderFormatToString(renderFormat));
                               ^
../src/compat.h:5:131: note: in definition of macro ‘PROP_SET’
   #define PROP_SET(tpl, propname, propvalue) tpl->SetNativeDataProperty(Nan::New(propname).ToLocalChecked(), Rsvg::propGetter, 0, propvalue)
                                                                                                                                   ^~~~~~~~~
../src/Rsvg.cc:453:31: note: suggested alternative: ‘RenderFormatFromString’
     PROP_SET(image, "format", RenderFormatToString(renderFormat));
                               ^
../src/compat.h:5:131: note: in definition of macro ‘PROP_SET’
   #define PROP_SET(tpl, propname, propvalue) tpl->SetNativeDataProperty(Nan::New(propname).ToLocalChecked(), Rsvg::propGetter, 0, propvalue)
                                                                                                                                   ^~~~~~~~~
../src/Rsvg.cc:455:40: error: ‘CairoFormatToString’ was not declared in this scope
         PROP_SET(image, "pixelFormat", CairoFormatToString(pixelFormat));
                                        ^
../src/compat.h:5:131: note: in definition of macro ‘PROP_SET’
   #define PROP_SET(tpl, propname, propvalue) tpl->SetNativeDataProperty(Nan::New(propname).ToLocalChecked(), Rsvg::propGetter, 0, propvalue)
                                                                                                                                   ^~~~~~~~~
../src/Rsvg.cc:455:40: note: suggested alternative: ‘CairoFormatFromString’
         PROP_SET(image, "pixelFormat", CairoFormatToString(pixelFormat));
                                        ^
../src/compat.h:5:131: note: in definition of macro ‘PROP_SET’
   #define PROP_SET(tpl, propname, propvalue) tpl->SetNativeDataProperty(Nan::New(propname).ToLocalChecked(), Rsvg::propGetter, 0, propvalue)
                                                                                                                                   ^~~~~~~~~
../src/Rsvg.cc: In static member function ‘static void Rsvg::SetStringProperty(const char*, const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/Rsvg.cc:485:37: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     String::Utf8Value arg0(ARGVAR[0]);
                                     ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
../src/Rsvg.cc: In static member function ‘static void Rsvg::SetNumberProperty(const char*, const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/Rsvg.cc:503:44: error: no matching function for call to ‘v8::Value::NumberValue()’
     gdouble value = ARGVAR[0]->NumberValue();
                                            ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note: candidate: v8::Maybe<double> v8::Value::NumberValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
                                       ^~~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2704:39: note:   candidate expects 1 argument, 0 provided
../src/Rsvg.cc: In static member function ‘static void Rsvg::SetIntegerProperty(const char*, const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/Rsvg.cc:521:40: error: no matching function for call to ‘v8::Value::Int32Value()’
     gint value = ARGVAR[0]->Int32Value();
                                        ^
In file included from /home/physikerwelt/.cache/node-gyp/12.16.1/include/node/node.h:63:0,
                 from ../src/Rsvg.h:4,
                 from ../src/Rsvg.cc:1:
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/physikerwelt/.cache/node-gyp/12.16.1/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
rsvg.target.mk:139: recipe for target 'Release/obj.target/rsvg/src/Rsvg.o' failed
make: *** [Release/obj.target/rsvg/src/Rsvg.o] Error 1
make: Leaving directory '/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/physikerwelt/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.19.81-microsoft-standard
gyp ERR! command "/home/physikerwelt/.nvm/versions/node/v12.16.1/bin/node" "/home/physikerwelt/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build/librsvg.node" "--module_name=librsvg" "--module_path=/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/physikerwelt/.nvm/versions/node/v12.16.1/bin/node /home/physikerwelt/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build/librsvg.node --module_name=librsvg --module_path=/mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt/build --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/mnt/c/git/wikipedia/mathoid-server/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.19.81-microsoft-standard
node-pre-gyp ERR! command "/home/physikerwelt/.nvm/versions/node/v12.16.1/bin/node" "/mnt/c/git/wikipedia/mathoid-server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /mnt/c/git/wikipedia/mathoid-server/node_modules/librsvg-prebuilt
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
SamuelScheit commented 3 years ago

same

yisibl commented 2 years ago

Try https://github.com/yisibl/resvg-js