-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install on Windows (syntax errors in common.hpp) #125
Comments
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: return Result_void { .error_code = 0, .error_msg = 0 }; It's kind of weird that it's ok with the similar code that is a couple of lines above it: return Result<T> { .error_code = 0, .error_msg = 0, .result = result }; |
Thanks for your help. I uninstalled Visual Studio completely, since the folks at the vcpkg repo said that my non-default installation directory might have been causing issues. Then I installed Visual Studio 2019 and the required SDKs. The syntax error issue seems to be gone, but now something else is going on. |
For Windows you pretty much have to enable |
I have that enabled. opencv = {version = "0.34", features = ["buildtime-bindgen"]} |
And you are still experiencing the same issue? Can you please post the full log then? The one you posted before has “cargo build -vv”, without features. |
|
Ah, I see now, thanks. What I can see from the log is that there is a version mismatch between the link library |
Ah, I did delete OpenCV and reinstall 4.2.0 from scratch, maybe I just need to update the OPENCV_LINK_LIBS environment variable? I'll try that when I get home. |
How did you install 4.2.0, by building it from the sources? |
There's an official Windows build of OpenCV 4.2.0 on the project's website: https://sourceforge.net/projects/opencvlibrary/files/4.2.0/opencv-4.2.0-vc14_vc15.exe/download |
New log: https://pastebin.com/UJikm05y So fixing the environment variable didn't help. |
Can you please also tell me which version of clang/llvm have you installed? And how did you install it? |
I installed llvm via chocolatey and then forced a reinstall after I reinstalled VC++. |
I wonder will it be possible for you to remove the 4.2.0 and install OpenCV from chocolatey just to rule out this part? Please also do a |
Sure. I installed it from the OpenCV website because I was under the impression that 4.1.2 wasn't supported. (crates.io says only 3.2, 3.4, and 4.2 are supported) I'm installing from Choco now, I'll let you know how it goes. |
That's a documentation error, I'll update it, thanks! |
The log is now too long for pastebin. It starts with:
and ends with https://pastebin.com/dP067hUW. I had to omit some stuff in between, sorry. Anyway, seems 4.1.2 behaves the same. :( |
Can you please try to change the path style to unix in your environment variables OPENCV_LINK_PATHS and OPENCV_INCLUDE_PATHS? So that they become
or alternatively
That's the only significant difference I can see between CI and your instance. |
With
With C:/tools/opencv/build/x64/vc15/lib I seem to get the same error as before: https://pastebin.com/1EX5nCn5 Thanks for your help with this. It's very frustrating when I want to write some code but I'm prevented by toolchain issues, and I'm really grateful for you trying to figure it out for me. |
Well, then it would be nice if I could investigate what exactly it generated. Would you be able to do a
Thanks! |
From the looks of it it seems that C++ standard library is completely missing for the binding generator. I'm starting to suspect llvm 10, can you please try replacing it with llvm 9.0.0 and trying again (cargo clean + cargo build)? In the meanwhile I'm doing the CI run with llvm 10 to see if I can reproduce that behavior. |
Nope, it's all good. Can you give me more details about the related installed software? As far as I understand you got llvm 10.0.0 and opencv 4.1.2 installed from choco. What about Visual Studio related packages? Can you provide me with the urls to the specific distributions and their versions that you have installed? |
And please also show me the output of the following commands: clang --print-search-dirs And this one, it's going to hang waiting for input so you'll need to Ctrl+C it: clang -E -x c++ - -v |
Same symptoms with llvm 9.0.1. For Visual Studio, I downloaded the latest (2019) Community edition from the official website. Installed .NET desktop development, Desktop development with C++ (including Windows 10 SDK), and Windows Universal CRT SDK.
My use case for OpenCV has passed, so there's no urgency any more. But I'm happy to keep testing things with you if you want to get to the bottom of it. At some point in future I might want to use OpenCV again and it would be nice if it worked. |
That's exactly it, this should list a bunch of Visual Studio header dirs:
like
And I can see that your clang is complaining about:
so it's somehow trying to reference the include directory from one of your old installations I suppose. Maybe some stale env var or not a clean uninstall of the old toolchain? The first one is the directory that contains standard library definitions. Can you please try to find out which directory it is on your machine? I suppose it's something along the lines of |
Were you able to follow up on that issue? |
Sorry for the delay. |
Well, I'm not sure why exactly clang tries to use the wrong include directory, but can you try setting up the environment variable |
Part 1: https://pastebin.com/ubDtqvVa Part 2: https://pastebin.com/DA5ct39N (Logs are too big for a single pastebin) |
Ah, sorry, I should have mentioned to use the latest version: 0.41.0. Will you please? |
An issue has just been fixed in the crate version 0.44.2 which I think was also causing the problems with your build. Would you be able to retest? |
@twistedfall I have the same issue, but in my case it was missing the "stddef.h" file. I tried using the I'm using windows 10 64bits and version 0.46 of this crate, so I still think the enviroment variable didn't fix this and somehow it's just not importing all standard libraries. Here are the logs using clang 10: And also, the limits.h file exists under the clang include folder My Cargo.toml file:
|
That's quite weird, clang should pick up you visual c++ include dirs, are you sure you have visual c++ build tools installed? Can you please also post the output of |
Here are the logs from
So clang is looking for visual studio build tools in the wrong directory.. In my case it's installed in Is there any way of changing the directory to this one? Or I have to reinstall visual studio in the directory clang wants? |
I managed to get this working by reinstalling visual studio 2019 under |
It's great to hear that! |
Windows 10
Then manually set
Also installed Universal CRT SDK through Visual Studio Installer and manually set additional environment variables:
4.1.2 (Also see the exact same issue with the 4.2.0 release from the OpenCV website)
https://pastebin.com/USHHvZbw
The text was updated successfully, but these errors were encountered: