-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Ubuntu 18.04 - app compilation fails #339
Comments
All errors:
|
The older OpenCV version doesn’t support everything that you’re using in your application. You’ll need to adjust the code for it to compile successfully. |
I see. Thanks. Another small issue (maybe you have a hint): I was compiling OpenCV 4.2.0 from source on 18.04, also with the contrib repo. While running my app it was missing "libopencv_viz.so:4.2". Any idea how to get this? |
I would need some more context for that. Some build logs for example |
Sure. I was compiling 4.2 on 18.04 following this (buggy) gist: https://dev.to/swervin/how-to-install-opencv-4-2-0-on-ubuntu-18-04-3i7l After |
I think the viz module has not been build... Checking |
If you're compiling OpenCV from the source anyway, why not take the latest version (4.5.5 at the moment)? |
I was just trying to align to 20.04... But possible, yes. The reason is definitely the missing VTK. Couldn't overcome this. Even with a source installation of VTK. I don't need that viz module, I could live w/o it |
Oh no... 4.5.5 cmake generates tons of errors and a missing VTK is one of it... Not worth the efforts. |
Just in case it's useful to you I used to build OpenCV on 18.04 for CI, you can find the build script here: opencv-rust/ci/install-bionic.sh Line 14 in a267928
|
Cool. Thanks for sharing. I will give it a try on my messed up 18.04 Linux box :) |
The problem remains in the end:
I'm not sure where this dependency comes from. I have compiled I ran the build from your script, there was no dependency missing, VTK was installed (from 7.1) and detected. All fine. Just not for the app :( Attached the complete build log. |
Re-building OpenCV from source with version 4.2.0 now. Let's see |
Hopping from error to error... With OpenCV 4.2 on 18.04 this is the new runtime error:
|
I think the opencv-rs approach is nice, but the dependency hell is a PITA. And we are not even talking about cross-platform... The bionic GLIBC version is 2.27... |
Let's go back a step. Say, I would try to align my app to be compatible with OpenCV 3.2 and 4.2 (for 18.04 and 20.04). How could I achieve that? If I look at the errors above, then it seems to be doable. I'm a bit concerned about this
How is opencv-rs supposed to be compatible with 3.2 if this does not work? |
When you build your project the opencv crate will generate bindings for the OpenCV that it was able to find. But it's not always possible for your code to be portable between different OpenCV versions (same is also true for C++ code). In Rust case you can use conditional compilation like it's done in this example: https://github.com/twistedfall/opencv-rust/blob/master/examples/video_capture.rs#L11 So you have 3 options: At the moment I wouldn't really target OpenCV 3.2, this version is very old and unmaintained upstream. The crate will drop the support for it at some point. |
Cool. Thanks. Will try that. Better to stick with the default OpenCV background of a particular Ubuntu version |
The determination seems to not work on my 18.04, even though all 4.x stuff is removed. I'm sure I only have 3.2 installed, but it still tries to resolve 4.x references. |
Disregard please. I'm giving up here. Thanks for your help so far |
There is definitely something wrong with OpenCV 3.2 and 18.04. I'm having a default installation of 3.2 on 18.04
Not even a minimalistic app links correctly:
cargo build ends with:
The problem is: The linker is right! The /usr/lib/x86_64_linux-gnu dir contains a lot of opencv-related libs, such as
But not the a.m. missing. But they are all there, just w/o "3.2" |
Something seems not right with your system install. I'm running the crate tests on 18.04 exactly for the reason for testing against OpenCV 3.2 from the repository and everything runs fine, the install script is trivial: https://github.com/twistedfall/opencv-rust/blob/master/ci/install-bionic.sh |
Yeah, I think so. But what shall I do? I have now several times installed and removed, even manually, EVERYTHING what did sound like "opencv" from the system. It doesn't help. I tend to believe you, but I can't overcome this. I'm regularly getting dpkg warnings regarding missing file lists for exactly these packages... An installation on a VM was successful |
Strange. I was always running the setup like so |
But can you tell me, what |
I'm sure, it is due to my limited Rust knowledge, but this also does not compile: Besides the fact, that
|
Not sure why all the world is so keen to do Rust. This language is brain-fuck. This works:
|
However, |
Can you post the full build log |
Thank you very much for your help. Will provide the info soon. |
Here we go. I can see the "branch_32" somehow in the log. It works on devices, where the "not" case is true, but not on 18.04 with 3.2. My code parts, which are decorated with the conditional:
But for some reason the |
I see and I can confirm that it's indeed the issue. |
Thanks for taking care |
It turns out that it's not really possible to propagate configuration directives to the outside crates. In version 0.63.2 I've implemented the new way of doing conditional compilation: opencv::opencv_branch_32! {
let mut cam = videoio::VideoCapture::new_default(0)?; // 0 is the default camera
}
opencv::not_opencv_branch_32! {
let mut cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?; // 0 is the default camera
} and for imports: opencv::opencv_branch_4! {
use opencv::core::AccessFlag::ACCESS_READ;
}
opencv::not_opencv_branch_4! {
use opencv::core::ACCESS_READ;
} There are 6 macros: |
Thanks for your efforts. I will give it a try and report. |
No, disregard. All fine. VSCode wasn't fast enough |
Well done. Works perfectly. Thanks a lot. |
Is there anything to consider on Ubuntu 18.04?
My rust application uses the latest opencv crate, but fails to compile on 18.04. No issue on 20.04
20.04 has OpenCV 4.2.0, while 18.04 comes with 3.2. This seems to be a problem.
Collection of problems:
The text was updated successfully, but these errors were encountered: