creatale / node-dv

A node.js library for processing and understanding scanned documents
Other
340 stars 72 forks source link

Error during installation #29

Open Pitbi opened 9 years ago

Pitbi commented 9 years ago

Hey,

I would try node-dv (1.10.1). But I have some problems when installing via npm.

npm install dv

Do you have any idea?

Thx

With node 4.2.1:

../deps/opencv/modules/core/src/arithm1.cpp:444:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
../deps/opencv/modules/core/src/arithm1.cpp:444:51: note: insert an explicit cast to silence this issue
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
                                                  static_cast<int>( )
../deps/opencv/modules/core/src/arithm1.cpp:444:75: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                          ^~~~~~~~~~
../deps/opencv/modules/core/src/arithm1.cpp:444:75: note: insert an explicit cast to silence this issue
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                          ^~~~~~~~~~
                                                                          static_cast<int>( )
2 errors generated.
make: *** [Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/Pitbi/.nvm/v4.2.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/Users/Pitbi/.nvm/v4.2.1/bin/node" "/Users/Pitbi/.nvm/v4.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Pitbi/Projects/TEST/DocumentVision/node_modules/dv
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/Pitbi/.nvm/v4.2.1/bin/node" "/Users/Pitbi/.nvm/v4.2.1/bin/npm" "install" "--save" "dv"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! dv@1.10.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dv@1.10.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the dv package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls dv
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Pitbi/Projects/TEST/DocumentVision/npm-debug.log

With node 0.12.7:

../src/image.cc:192:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    auto ctor = Nan::New<v8::FunctionTemplate>(New);
    ^
../src/image.cc:193:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    auto ctorInst = ctor->InstanceTemplate();
    ^
../src/image.cc:264:34: error: a space is required between consecutive right angle brackets (use '> >')
                std::vector<v8::Local<v8::Value>> args(info.Length());
                                               ^~
                                               > >
../src/image.cc:266:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto inst = Nan::NewInstance(info.Callee(), args.size(), args.data());
            ^
../src/image.cc:1041:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        const auto strX = Nan::New("x").ToLocalChecked();
              ^
../src/image.cc:1042:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        const auto strY = Nan::New("y").ToLocalChecked();
              ^
../src/image.cc:1043:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        const auto strP1 = Nan::New("p1").ToLocalChecked();
              ^
../src/image.cc:1044:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        const auto strP2 = Nan::New("p2").ToLocalChecked();
              ^
../src/image.cc:1045:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        const auto strError = Nan::New("error").ToLocalChecked();
              ^
../src/image.cc:1024:23: warning: comparison of integers of different signs: 'int' and 'l_uint32' (aka 'unsigned int') [-Wsign-compare]
        if ((accuracy >= obj->pix_->w) || (accuracy >= obj->pix_->h)) {
             ~~~~~~~~ ^  ~~~~~~~~~~~~
../src/image.cc:1024:53: warning: comparison of integers of different signs: 'int' and 'l_uint32' (aka 'unsigned int') [-Wsign-compare]
        if ((accuracy >= obj->pix_->w) || (accuracy >= obj->pix_->h)) {
                                           ~~~~~~~~ ^  ~~~~~~~~~~~~
../src/image.cc:1260:11: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    const auto strX = Nan::New("x").ToLocalChecked();
          ^
../src/image.cc:1261:11: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    const auto strY = Nan::New("y").ToLocalChecked();
          ^
12 warnings and 1 error generated.
make: *** [Release/obj.target/dvBinding/src/image.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/Pitbi/.nvm/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "node" "/Users/Pitbi/.nvm/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Pitbi/Projects/TEST/DocumentVision/node_modules/dv
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/Pitbi/.nvm/v0.12.7/bin/node" "/Users/Pitbi/.nvm/v0.12.7/bin/npm" "install" "--save" "dv"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! dv@1.10.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dv@1.10.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the dv package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls dv
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Pitbi/Projects/TEST/DocumentVision/npm-debug.log    
soupman99 commented 9 years ago

I'm having the same problem. Tried to downgrade to node 0.10.0 but still have the error.

maxharlow commented 9 years ago

Same problem here also using Node 5.1.

teamhail commented 9 years ago

Chiming in to note I have the same problems as Pitb also on node v4.2.1.

CXX(target) Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o ../deps/opencv/modules/core/src/arithm1.cpp:444:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing] static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; ^~~~~~ ../deps/opencv/modules/core/src/arithm1.cpp:444:51: note: insert an explicit cast to silence this issue static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; ^~~~~~ static_cast( ) ../deps/opencv/modules/core/src/arithm1.cpp:444:75: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing] static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; ^~~~~~ ../deps/opencv/modules/core/src/arithm1.cpp:444:75: note: insert an explicit cast to silence this issue static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; ^~~~~~ static_cast( ) 2 errors generated. make: *\ [Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o] Error 1

rashfael commented 9 years ago

I just forced dv to build with clang on my (Linux) machine and could reproduce the error, I'll be back with a solution.

rashfael commented 9 years ago

I added the compiler flag "-Wno-c++11-narrowing" which fixes the problem on linux with my forced clang. Can anyone of you with OSX/xcode verify the fix in the newest commit on master (xcode needs a different configuration for the flag)?

pakTech786 commented 9 years ago

After many tries i could able to run dv version 1.9.3 in node version 0.10.39.it is running now

toabi commented 9 years ago

osx, node v4.2.1, npm install https://github.com/creatale/node-dv.git this happens:

In file included from ../deps/tesseract/ccmain/equationdetect.cpp:38:
In file included from ../deps/tesseract/textord/bbgrid.h:26:
../deps/tesseract/ccutil/hashfn.h:25:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
49 warnings and 1 error generated.
make: *** [Release/obj.target/libtesseract/deps/tesseract/ccmain/equationdetect.o] Error 1
diegoperini commented 8 years ago

Still fails to build on Mac OS X after the latest commit on master.

In file included from ../deps/tesseract/ccmain/equationdetect.cpp:38:
In file included from ../deps/tesseract/textord/bbgrid.h:26:
../deps/tesseract/ccutil/hashfn.h:25:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
49 warnings and 1 error generated.
make: *** [Release/obj.target/libtesseract/deps/tesseract/ccmain/equationdetect.o] Error 1
diegoperini commented 8 years ago

Downgraded dv to 1.9.2, here is the error.

 CXX(target) Release/obj.target/libopencv/deps/opencv/modules/core/src/algorithm.o
 CXX(target) Release/obj.target/libopencv/deps/opencv/modules/core/src/alloc.o
 CXX(target) Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o
../deps/opencv/modules/core/src/arithm1.cpp:444:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
../deps/opencv/modules/core/src/arithm1.cpp:444:51: note: insert an explicit cast to silence this issue
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
                                                  static_cast<int>( )
../deps/opencv/modules/core/src/arithm1.cpp:444:75: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                          ^~~~~~~~~~
../deps/opencv/modules/core/src/arithm1.cpp:444:75: note: insert an explicit cast to silence this issue
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                          ^~~~~~~~~~
                                                                          static_cast<int>( )
2 errors generated.
make: *** [Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o] Error 1
rashfael commented 8 years ago

The problem is definitely some missing compiler flags for OSX/clang, but diagnosing and finding a solution is quite difficult without a Mac. It probably needs something like that in xcode_settings in the commons.gyp:

'OTHER_CPLUSPLUSFLAGS' : ['-std=c++11','-stdlib=libc++'],
'OTHER_LDFLAGS': ['-stdlib=libc++'],
diegoperini commented 8 years ago

I'm on to it. Can I npm test after I applied the patch?

diegoperini commented 8 years ago

I changed OS X specific lines in commons.pyp with this:

['OS=="mac"',
        {
          'xcode_settings': {
            'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
            'OTHER_CFLAGS': [ '-O3', '-march=native', '-w' ],
            'OTHER_CPLUSPLUSFLAGS' : ['-Wno-c++11-narrowing', '-std=c++11', '-stdlib=libc++'],
            'OTHER_LDFLAGS': ['-stdlib=libc++'],
          }
        }
      ],

I get an error at the beginning of the build:

> dv@1.10.1 install /Users/diego/node_modules/dv
> node-gyp rebuild

  CXX(target) Release/obj.target/jpg/deps/jpg/jpgd.o
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make: *** [Release/obj.target/jpg/deps/jpg/jpgd.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
diegoperini commented 8 years ago

Managed to surpass the error by adding an additional -mmacosx-version-min=10.7 clang flag and removing OTHER_LDFLAGS entirely. I will send a pull request once I finish testing. Mac OS X versions that are older than Lion will not be supported though.

diegoperini commented 8 years ago

Build succeeded. Tests failed at some point. Here is the test result:

> dv@1.10.1 test /Users/diego/Projects/diego/node-dv
> mocha test

   Image
    ✓ should construct from raw data (grayscale)
    ✓ should construct from raw data (rgb)
    ✓ should construct from raw data (rgba)
    ✓ should save using #toBuffer() (573ms)
    ✓ should return raw image data using #toBuffer()
    ✓ should #invert() (144ms)
    ✓ should #or(), #and(), #xor(), #add() and #subtract() (337ms)
    ✓ should #add() and #subtract() arithmetically for grayscale
    ✓ should #add() and #subtract() arithmetically for rgb
    ✓ should #convolve()
    ✓ should #unsharp() (132ms)
    ✓ should #rotate() (339ms)
    ✓ should #scale() (454ms)
    ✓ should #crop()
    ✓ should #inRange()
    ✓ should #rankFilter() (149ms)
    ✓ should #toGray() (224ms)
    ✓ should #toHSV() and #toRGB() (153ms)
    ✓ should #erode() (148ms)
    ✓ should #dilate()
    ✓ should #open() (152ms)
    ✓ should #close() (129ms)
    ✓ should #thin()
    ✓ should #otsuAdaptiveThreshold(), #findSkew()
    ✓ should #lineSegments(), #drawLine() (315ms)
    ✓ should throw error on too large precision
    ✓ should #connectedComponents() (628ms)
    ✓ should #distanceFunction() and #maxDynamicRange()
    ✓ should #fillBox() (362ms)
    ✓ should #drawBox() (388ms)
    ✓ should #drawImage()
    ✓ should #octreeColorQuant()
    ✓ should #medianCutQuant()
    ✓ should #threshold()
    ✓ should #histogram()
    ✓ should #projection()
    ✓ should #applyCurve() and #setMasked() (187ms)

  Tesseract
    ✓ should #clear()
    ✓ should #clearAdaptiveClassifier()
    ✓ should set #image to null
    ✓ should set #image
    ✓ should set/get variables
    ✓ should set/get a whitelist
    ✓ should #findRegions() (4471ms)
    ✓ should #findRegions(false) (1352ms)
    ✓ should #findTextLines() (4248ms)
    ✓ should #findTextLines(false) (1396ms)
    ✓ should #findParagraphs() (4432ms)
    ✓ should #findParagraphs(false) (1343ms)
    ✓ should #findWords() (3984ms)
    ✓ should #findWords(false) (1362ms)
    ✓ should #findSymbols() (4101ms)
    ✓ should #findSymbols(false) (1352ms)
    ✓ should #findText('plain') (3480ms)
    ✓ should #findText('plain', true) (3512ms)
    ✓ should #findText('unlv') (3818ms)
    ✓ should #findText('unlv', true) (3544ms)
    ✓ should #findText('hocr', 0) (3503ms)
    ✓ should #findText('box', 0) (3541ms)
    ✓ should generate hOCR without recognition (527ms)

  ZXing
    ✓ should have no #image set
    ✓ should set #image to null
    ✓ should have #formats set
    ✓ should have #tryHarder
    #findCode()
      ✓ should find nothing
node(58866,0x7fff7266f000) malloc: *** error for object 0x7fff50983a99: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
pakTech786 commented 8 years ago

any luck here???? i still cannot install dv with node versions later than 0.10.39......while i want to use it with node version 4.but i am getting this error

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h(4774): error C3861:        '__uncaught_exception': identifier not found (..\..\..\deps\opencv\modules\core\src\parallel.cpp)

i am using visual studio 2013.

rashfael commented 8 years ago

Please see #31 to report your platform and version, so we can set up automated testing for your platform.

diegoperini commented 8 years ago

Seen it, hope I could help.

oscarvalente commented 8 years ago

Any updates on this since then? In my case npm install didn't work for any version.

LIBTOOL-STATIC Release/tesseract.a make: *** No rule to make targetRelease/obj.target/libzxing/deps/zxing/core/src/bigint/BigInteger.o', needed by Release/zxing.a'. Stop. gyp ERR! build error

onlinegeek101 commented 8 years ago

Will a patch be out for this issue? Or if not how can I build this locally and npm install?

sourcehunter commented 8 years ago

@onlinegeek101: use npm link when you compile the code directly.

  1. execute npm link in the cloned node-dv repository
  2. execute npm link dv in your project
rashfael commented 8 years ago

Alternatively, per direct git reference (https://docs.npmjs.com/cli/install (g)).

hilaby commented 8 years ago

I had the same issues on my Mac, took a while to figure it out but after checking this link https://travis-ci.org/creatale/node-dv/jobs/101310954 I found that typing: export CXX="g++-4.8" CC="gcc-4.8" into your command prompt before you type npm install dv would solve the problem

pauloerweber commented 7 years ago

Having same issue. Tried the tweak @hilaby did, to no avail. Reinstalled node, no change. node 6.9.5 npm 3.10.10 gcc Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.4.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

CXX(target) Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o

../deps/opencv/modules/core/src/arithm1.cpp:444:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]

static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                              ^~~~~~~~~~

../deps/opencv/modules/core/src/arithm1.cpp:444:51: note: insert an explicit cast to silence this issue

static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                              ^~~~~~~~~~
                                              static_cast<int>( )

../deps/opencv/modules/core/src/arithm1.cpp:444:75: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]

static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                      ^~~~~~~~~~

../deps/opencv/modules/core/src/arithm1.cpp:444:75: note: insert an explicit cast to silence this issue

static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                                      ^~~~~~~~~~
                                                                      static_cast<int>( )

2 errors generated.

make: *** [Release/obj.target/libopencv/deps/opencv/modules/core/src/arithm1.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (
/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.4.0
gyp ERR! command "/usr/local/bin/node"  "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/CASABRASIL/node_modules/dv
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "dv"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! dv@1.10.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dv@1.10.1 install script 'node-gyp rebuild'.
mscharfstein commented 7 years ago

^ having the same issue and the tweaks suggested did not fix it. Any udpate here?

node 7.6.0 npm 4.1.2 error log: npm-debug.log

muditjuneja commented 6 years ago

Anything on this error? I am still facing it. OS:Mac OS X