justadudewhohacks / justadudewhohacks/opencv4nodejs
[WINDOWS 10][ELECTRON][REBUILD][C1083][LNK2001][SOLVED]
- Dominant language
- C++
- Stars
- 5.1k
- Forks
- 826
- PR merge metrics
- No merged PRs in 30d
Description
That is not a issue. Just tips for anyone that straggling like me.
Before the start i need to say that i tried every solution that found in there and in google and only manual editing of the binding.gyp helped me. I tried setting folders in env variables etc. Why I mention this I will explain in the end.
Tested on Windows 10, Python 2.7, MS Build Tools 2017.
If you trying to rebuild "opencv4nodejs" for Electron (maybe other similar soft) and getting "**C1083**" errors (many-many errors):
1. Check if you have **white-spaces** in your project path and delete them if any.
2. Go to (YOUR PROJECT)\node_modules\opencv4nodejs and edit **binding.gyp** file:
Add **"../opencv-build/opencv/build/include"** to the **"include_dirs"** array.
After this you will likely get "**LNK2001**" errors on rebuild. To fix this:
1. Go to (YOUR PROJECT)\node_modules\opencv4nodejs and edit **binding.gyp** file (again):
Add **every** .lib file from (YOUR PROJECT)\node_modules\opencv-build\opencv\build\x64\vc15\lib\ to the **"libraries"** array.
Format of the path needs to be like this:
"(FULL PATH TO YOUR PROJECT)\\\\node_modules\\\\opencv-build\\\\opencv\\\\build\\\\x64\\\\vc15\\\\lib\\\\opencv_calib3d346"
Don't forget to escape every **"\\"** like in the example path above - **"\\\\"**.
The final look:

And now explanation why I mentioned that I tried setting folders in env. Because the manual steps that I've done is automated in binding.gyp. But they are clearly not working. I can assume that problem is in install.js file. Because when parseEnv.js trying to fetch OPENCV4NODEJS_INCLUDES or OPENCV4NODEJS_LIBRARIES they are empty. I will check it out later but I can be wrong so don't expect anything ;)
Contributor guide
Research direction
Compare the manual binding.gyp workaround with how install.js and parseEnv.js obtain OPENCV4NODEJS_INCLUDES and OPENCV4NODEJS_LIBRARIES; first inspect those files and reproduce the Windows 10 Electron rebuild using the versions listed. Done means the intended include and library paths are handled or the workaround is documented clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, electron, javascript, node.js, python
- Domain
- build-system, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100