Skip to content
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

OpenCV compilation error #27

Closed
PenguineZhang opened this issue Jul 23, 2020 · 8 comments · May be fixed by #282
Closed

OpenCV compilation error #27

PenguineZhang opened this issue Jul 23, 2020 · 8 comments · May be fixed by #282
Assignees
Milestone

Comments

@PenguineZhang
Copy link

Is there opencv version requirement to compile the code? My workaround is to change CV_AA to CV_L1 as suggested by the compiler. My machine is using OpenCV 4.1.0. See attached and let me know what you think.
Screenshot from 2020-07-22 21-12-24

@bsb808
Copy link
Contributor

bsb808 commented Jul 23, 2020

This does seem like a dependency issue with the setup. That source file does make use of...

#include <cv_bridge/cv_bridge.h>
#include <opencv2/core/core.hpp>

Can you make sure you have the setup as described here. One thing that causes issues is to make sure you have the updated Gazebo 9 from OSRF. It should be Gazebo multi-robot simulator, version 9.13.1

@BruceMty Do we need the sonar_dave_plugins anymore? It look like this is a copy of the source file from the uuv_simulator Can we remove that part of the repository?

@BruceMty
Copy link
Contributor

@bsb808 , this is a copy but we currently need it, see #25. I expect that uuv_simulator will raise the same CV complaint. For me, typing "pkg-config --modversion opencv" indicates CV version 3.2.0.

@PenguineZhang
Copy link
Author

@BruceMty @bsb808 Upgrading to Gazebo 9.13.2 (should be the latest) still raised the same compilation issue. The output of "pkg-config --modversion opencv" also indicates 3.2.0. It turned out CV_AA is defined in "opencv2/imgproc/imgproc_c.h". When I added include <opencv2/imgproc/imgproc_c.h>, it compiled sucdessfully.

@bsb808
Copy link
Contributor

bsb808 commented Jul 23, 2020

That is strange that we aren't seeing the same thing - suggests that the development environment is not equivalent. This is a perfect reason why we need some CI/CD to provide checks for this in a clean dev. env.

I suggest we incur the technical debt and use this as our first test case of @PenguineZhang submitting a PR through gitlab that eventually makes it to the github repo.

@PenguineZhang
Copy link
Author

@bsb808 Is there a mirror repo already at Gitlab? I have not received the invite to Gitlab yet.

@M1chaelM
Copy link
Contributor

@PenguineZhang I just got it set up and sent you an invite. Let me know if you have any trouble.

@M1chaelM M1chaelM added this to the 2.0 milestone Sep 15, 2020
@mabelzhang
Copy link
Contributor

First, adding the #include seems the right thing to do anyway. I suspect a strict linter would tell you to include the header files you're using. As you mentioned, CV_AA is defined in imgproc_c.h even in 3.2.0: https://docs.opencv.org/3.2.0/globals_c.html

Second, for the sake of looking into the issue, I have 3.2.0 installed from binaries in a homemade Docker image, and I don't have compiler errors. Bruce's command above gives me 3.2.0 as well.

Do you have two versions of OpenCV installed? 4.1.0 from source (as I think you mentioned), and 3.2.0 from binaries (along with other things like ROS that might have installed it). It could be that pkg-config picked up your binary install, and the compiler picked up the source install and produced the error.

What if you add the following line in your dave/sonar_dave_plugins/sonar_dave_uuv/CMakeLists.txt after find_package(OpenCV REQUIRED),

message("OpenCV version: " ${OpenCV_VERSION})

and see what it says at compile time? That would tell us the version of OpenCV that CMake is getting and might give us some clues.

Third, what is the command you ran to compile? Usually, this kind of discrepancy can happen if that header file is indirectly included by some other file being compiled in the collection - I'm compiling everything in the workspace, so one of the files could have included a file that includes imgproc_c.h. If you're compiling only a few packages, maybe none of them happened to do that, and you'd get that error. In that sense, you are compiling in a cleaner environment than I am, and that's usually how CI machines are set up, so that they're stricter on missing dependencies.

However, that doesn't seem the case here. I rm -rf build install and ran colcon build --packages-up-to sonar_dave_uuv (this compiles sonar_dave_uuv and all its dependency packages, and everything still compiled without error. The packages that this command compiled are sonar_dave_uuv, uuv_gazebo_plugins, and uuv_sensor_ros_plugins_msgs. So I think something else is going on.

@mabelzhang
Copy link
Contributor

Closing as issue seems to have been resolved. Feel free to reopen if it crops up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants