justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.95k stars 826 forks source link

Build fails with OPENCV4NODEJS_DISABLE_AUTOBUILD=1 #528

Open jasonpolites opened 5 years ago

jasonpolites commented 5 years ago

Error Message

> opencv-build@0.0.17 install /usr/src/app/node_modules/opencv-build
> node ./install.js

info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...

> opencv4nodejs@4.14.1 install /usr/src/app/node_modules/opencv4nodejs
> node-gyp rebuild

make: Entering directory '/usr/src/app/node_modules/opencv4nodejs/build'
  CXX(target) Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o
In file included from ../cc/CustomMatAllocator.h:8:0,
                 from ../cc/ExternalMemTracking.h:2,
                 from ../cc/opencv4nodejs.cc:2:
../cc/core/Size.h:1:28: fatal error: opencv2/core.hpp: No such file or directory
 #include <opencv2/core.hpp>
                            ^
compilation terminated.
make: *** [Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o] Error 1
opencv4nodejs.target.mk:227: recipe for target 'Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o' failed
make: Leaving directory '/usr/src/app/node_modules/opencv4nodejs/build'
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:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.9.125-linuxkit
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 /usr/src/app/node_modules/opencv4nodejs
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

Auto Build - Full Error Log

N/A

Manual Build - Environment Information

OpenCV version

Built from source, using the following commands:

git clone --progress --verbose https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..
make install

This appears to create include paths that look like /usr/local/include/opencv4/opencv2/

With OpenCV-contrib? (extra modules): No

OS: This is in a Docker build, with FROM node:10. I believe that's Ubuntu (?)

jasonpolites commented 5 years ago

Hmm.. possibly related:

https://github.com/opencv/opencv/issues/5989

timrach commented 5 years ago

I had the same issue - turns out i built opencv version 4.
Using version 3.4.6 installation works fine.

mattfiocca commented 5 years ago

I was having the same exact error message, having thought i manually installed OpenCV 3.4.6 on Ubuntu 16.

It turns out I forgot to actually make install after make'ing the source, and then promptly deleted the source directories after the incomplete "installation". oops...

After reinstalling (completely) OpenCV 3.4.6 from source, using -D CMAKE_INSTALL_PREFIX=/usr/local during the cmake configuration, my npm install with auto build disabled stopped reporting these errors.

npm is hanging on me now though, it just gets here and hangs:

> opencv-build@0.1.4 install /srv/incidentclear/microservices/services/frontend/node_modules/opencv-build
> node ./install.js

info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...

> opencv4nodejs@5.1.0 install /srv/incidentclear/microservices/services/frontend/node_modules/opencv4nodejs
> node-gyp rebuild --jobs max

make: Entering directory '/srv/incidentclear/microservices/services/frontend/node_modules/opencv4nodejs/build'
  CXX(target) Release/obj.target/opencv4nodejs/cc/CustomMatAllocator.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o

But this is a separate topic i suppose