justadudewhohacks / opencv4nodejs

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

Auto install fails when using custom DBUILD_LIST #609

Open mtford90 opened 5 years ago

mtford90 commented 5 years ago

See title. Note that install works perfectly fine without the DBUILD_LIST but fails with this flag:

export OPENCV4NODEJS_AUTOBUILD_FLAGS=-DBUILD_LIST=core,imgproc,imgcodecs

Error Message

/usr/bin/ld: cannot find -lopencv_highgui
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_calib3d
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_videoio
/usr/bin/ld: cannot find -lopencv_videostab
/usr/bin/ld: cannot find -lopencv_dnn
/usr/bin/ld: cannot find -lopencv_face
/usr/bin/ld: cannot find -lopencv_text
/usr/bin/ld: cannot find -lopencv_tracking
/usr/bin/ld: cannot find -lopencv_xfeatures2d
/usr/bin/ld: cannot find -lopencv_ximgproc
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/opencv4nodejs.node] Error 1
make: Leaving directory `/home/ec2-user/genolingo-opencv-layer/nodejs/node_modules/opencv4nodejs/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ec2-user/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

Auto Build - Full Error Log

https://pastebin.com/6uLCjS2C

Environment

OpenCV version: 3.4.6 (chosen by autobuild)

With OpenCV-contrib? : no

OS:

$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
dadanhrn commented 5 years ago

Can confirm with below command: OPENCV4NODEJS_AUTOBUILD_FLAGS=-DBUILD_LIST=core,imgproc,imgcodecs,photo,highgui npm install --save opencv4nodejs

Similar error message was shown:

  SOLINK_MODULE(target) Release/obj.target/opencv4nodejs.node
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_calib3d
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_videoio
/usr/bin/ld: cannot find -lopencv_videostab
/usr/bin/ld: cannot find -lopencv_dnn
/usr/bin/ld: cannot find -lopencv_face
/usr/bin/ld: cannot find -lopencv_text
/usr/bin/ld: cannot find -lopencv_tracking
/usr/bin/ld: cannot find -lopencv_xfeatures2d
/usr/bin/ld: cannot find -lopencv_ximgproc
collect2: error: ld returned 1 exit status
make: *** [opencv4nodejs.target.mk:293: Release/obj.target/opencv4nodejs.node] Error 1
make: Leaving directory '/home/dadanhrn/opencvnode/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/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 5.1.3-arch1-1-ARCH
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd /home/dadanhrn/opencvnode/node_modules/opencv4nodejs
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok

Installation debug log: https://pastebin.com/b2c2zq5D

gallagherrchris commented 5 years ago

Looks like they need to be space separated instead of comma. EDIT: That seems to only be if you want multiple flags, not if you want multiple values in the DBUILD_LIST

https://github.com/justadudewhohacks/opencv4nodejs#auto-build-flags