opencv-rust: Cannot install on Windows (syntax errors in common.hpp)
- Operating system
Windows 10
- The way you installed OpenCV: package, official binary distribution, manual compilation, etc.
choco install llvm opencv
Then manually set
OPENCV_DIR=C:\tools\opencv\build\x64\vc14\lib
OPENCV_INCLUDE_PATHS=C:\tools\opencv\build\include
OPENCV_LINK_LIBS=opencv_world412
OPENCV_LINK_PATHS=C:\tools\opencv\build\x64\vc15\lib
OPENCV_PATH=C:\tools\opencv
Also installed Universal CRT SDK through Visual Studio Installer and manually set additional environment variables:
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include;D:\Windows Kits\10\Include\10.0.17763.0\ucrt;D:\Windows Kits\10\Include\10.0.17763.0\um;
LIB=D:\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;D:\Windows Kits\10\Lib\10.0.17763.0\um\x64
- OpenCV version
4.1.2 (Also see the exact same issue with the 4.2.0 release from the OpenCV website)
- Attach the full output of the following command from your project directory:
$env:RUST_BACKTRACE="full"; cargo build -vv
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 38 (20 by maintainers)
That’s quite weird, it looks like your version of cl.exe does not accept some code. As far as I can see the version used in CI works correctly.
Your compiler is:
The working one in CI:
I’m not that familiar with the versioning of Visual Studio compilers, but it looks like it’s 2019 vs 2017. So can you please update to 2019 first and then try again?
The code that it rejects is struct initializer:
It’s kind of weird that it’s ok with the similar code that is a couple of lines above it: