peterbraden / node-opencv

OpenCV Bindings for node.js
MIT License
4.38k stars 857 forks source link

Error: undefined symbol: _ZN2cv11_InputArrayC1ERKNS_3MatE #605

Closed bjornkeyser closed 5 years ago

bjornkeyser commented 6 years ago

Hi, I have been trying to run node-opencv for almost a week now, first I had trouble installing it and now I keep getting this error when I run the example file called face-detection.js. My error: module.js:435 return process.dlopen(module, path._makeLong(filename)); ^

Error: /home/susanne/Documenten/node_modules/opencv/build/opencv/v6.0.0/Release/node-v46-linux-ia32/opencv.node: undefined symbol: _ZN2cv11_InputArrayC1ERKNS_3MatE at Error (native) at Object.Module._extensions..node (module.js:435:18) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/susanne/Documenten/node_modules/opencv/lib/bindings.js:4:15) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32)

This is what I am using, and I have tried a different node and npm version before which didn't work. opencv: 2.4.11 node-opencv: 6.0.0 python: 2.7.12 ubuntu: 16.04 node: v4.6.0 npm: 2.15.9

Please help, my graduation depends on this and I haven't even started programming yet.

btsimonh commented 6 years ago

Hi @bjornkeyser,

I would strongly recommend moving to recent versions of everything. I have success (on Windows 10 and rpi debian) with:

node 6.9.1 & 6.9.11 opencv 3.3.0 (avoid 3.0.0, 3.1.0) and to install, use 'npm install peterbraden/node-opencv' - which will install the master branch directly from github (still has 6.0.0 version stamp). Ignore errors about pre-built binaries and let it build from source.

I can't speak for face-detection.js, not tried it; but all samples are run as part of the tests every commit, so it at least should not error. I have built with OpenCV 2.4, but not on linux.

The error seems to indicate it can't find either the .node file (which it built) or a dependency (i.e. opencv itself or a dependency thereof). Double check all paths work (e.g. in opencv bin folder, there are test execuables.. make sure you can run these from anywhere. Hopefully someone with some more direct linux knowledge will chip in :).

good luck,

Simon

bjornkeyser commented 6 years ago

Well I have just tried using the exact same versions as you did. Node 6.9.1 and OpenCV 3.3.0 and I ran npm install peterbraden/node-opencv, but when I run a test from the examples folder now it gives me the same error I had a while ago: module.js:328 throw err; ^

Error: Cannot find module '/home/susanne/Documenten/node_modules/opencv/build/opencv/v6.0.0/Release/node-v46-linux-ia32/opencv.node' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/susanne/Documenten/node_modules/opencv/lib/bindings.js:4:15) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:

That path is almost identical to the path where it should be; it is located in node-v48-linux-ia32 instead of v46. The last time I fixed this by using some different version of Node. When that was fixed the error of my initial issue came up.

Ignore errors about pre-built binaries and let it build from source.

Maybe I had to use npm install peterbraden/node-opencv --build-from-source, I don't really know. When commanding "npm outdated" I see that a lot of depencies are missing, I don't know how that came about.

UPDATE: using the command npm install peterbraden/node-opencv --build-from-source did it for installing the dependencies as well, no more missing packages but still the same error when running test.js as before.

bjornkeyser commented 6 years ago

YESSSSSS it finally worked I have been trying this for like 10 hours in total because I am a teenage noob, but just changing to node 4.6.0 did the trick. So basically it's just a combination of the right versions of packages (OpenCV 3.3.0) and using npm install ... --build-from-source I guess. Hallelujah praise the lord I can go to sleep.

RGKrish183 commented 5 years ago

Yes its, working fine @bjornkeyser thanks for time, i spent to find the solutions 1.5 working hours.

sudo npm install opencv --unsafe-perm=true --build-from-source