I am trying to install the "opencv4nodejs" package on a MAC by running this command:
CXXFLAGS=-std=gnu++11 npm i -g opencv4nodejs
That gives me the following error:
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv/modules/highgui/src/window_cocoa.mm:269:25: error: non-constant-expression cannot be narrowed from type 'int' to 'CGFloat' (aka 'double') in initializer list [-Wc++11-narrowing]
NSSize size = { width, height };
^~~~~
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv/modules/highgui/src/window_cocoa.mm:269:25: note: insert an explicit cast to silence this issue
NSSize size = { width, height };
^~~~~
static_cast<CGFloat>( )
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv/modules/highgui/src/window_cocoa.mm:269:32: error: non-constant-expression cannot be narrowed from type 'int' to 'CGFloat' (aka 'double') in initializer list [-Wc++11-narrowing]
NSSize size = { width, height };
^~~~~~
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv/modules/highgui/src/window_cocoa.mm:269:32: note: insert an explicit cast to silence this issue
NSSize size = { width, height };
^~~~~~
static_cast<CGFloat>( )
I found this answer that talks about the -Wno-c++11-narrowing
flag to ignore that error.
The problem is that I can't figure out how to pass that flag to the npm
command.
I've tried: CXXFLAGS=-std=c++11=-Wno-c++11-narrowing npm i -g opencv4nodejs
without success.
How can I pass that C++ flag down to the npm
command?