openCV versions understanding

I am working on with ROS-Melodic and its cv_bridge package needs openCV3.2 version, that’s why I cannot make catkin build -j4 my_package_name , it gives me error like :

aruco_gridboard:make /home/bba/ROS_ARDU_ws/logs/aruco_gridboard/build.make.015.log    
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `aruco_gridboard::readDetectorParameters(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, cv::Ptr<cv::aruco::DetectorParameters>&)':
node.cpp:(.text+0xfec): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `aruco_gridboard::Node::spin()':
node.cpp:(.text+0x2578): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
node.cpp:(.text+0x25a0): undefined reference to `cv::FileNode::operator float() const'
node.cpp:(.text+0x25ec): undefined reference to `cv::FileNode::begin() const'
node.cpp:(.text+0x25fc): undefined reference to `cv::FileNode::end() const'
node.cpp:(.text+0x261c): undefined reference to `cv::operator!=(cv::FileNodeIterator const&, cv::FileNodeIterator const&)'
node.cpp:(.text+0x2638): undefined reference to `cv::FileNodeIterator::operator*() const'
node.cpp:(.text+0x2be0): undefined reference to `cv::aruco::detectMarkers(cv::_InputArray const&, cv::Ptr<cv::aruco::Dictionary> const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::Ptr<cv::aruco::DetectorParameters> const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&)'
node.cpp:(.text+0x2d00): undefined reference to `cv::aruco::estimatePoseBoard(cv::_InputArray const&, cv::_InputArray const&, cv::Ptr<cv::aruco::Board> const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputOutputArray const&, cv::_InputOutputArray const&, bool)'
node.cpp:(.text+0x379c): undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
node.cpp:(.text+0x384c): undefined reference to `cv::destroyWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `void cv::operator>><std::vector<float, std::allocator<float> > >(cv::FileNode const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >&)':
node.cpp:(.text+0x3e84): undefined reference to `cv::FileNode::begin() const'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `void cv::operator>><int>(cv::FileNode const&, std::vector<int, std::allocator<int> >&)':
node.cpp:(.text+0x3ef0): undefined reference to `cv::FileNode::begin() const'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `void cv::read<float>(cv::FileNode const&, std::vector<float, std::allocator<float> >&, std::vector<float, std::allocator<float> > const&)':
node.cpp:(.text+0x4318): undefined reference to `cv::FileNode::empty() const'
node.cpp:(.text+0x4344): undefined reference to `cv::FileNode::begin() const'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `cv::Mat::Mat(int, int, int, void*, unsigned long)':
node.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x150): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x244): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x2cc): undefined reference to `cv::Mat::updateContinuityFlag()'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `cv::internal::VecReaderProxy<int, 1>::operator()(std::vector<int, std::allocator<int> >&, unsigned long) const':
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm[_ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm]+0x34): undefined reference to `cv::FileNodeIterator::remaining() const'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm[_ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm]+0xa0): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm[_ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm]+0x134): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm[_ZNK2cv8internal14VecReaderProxyIiLi1EEclERSt6vectorIiSaIiEEm]+0x1e0): undefined reference to `cv::FileNodeIterator::readRaw(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void*, unsigned long)'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `cv::internal::VecReaderProxy<std::vector<float, std::allocator<float> >, 0>::operator()(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >&, unsigned long) const':
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyISt6vectorIfSaIfEELi0EEclERS2_IS4_SaIS4_EEm[_ZNK2cv8internal14VecReaderProxyISt6vectorIfSaIfEELi0EEclERS2_IS4_SaIS4_EEm]+0x34): undefined reference to `cv::FileNodeIterator::remaining() const'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyISt6vectorIfSaIfEELi0EEclERS2_IS4_SaIS4_EEm[_ZNK2cv8internal14VecReaderProxyISt6vectorIfSaIfEELi0EEclERS2_IS4_SaIS4_EEm]+0x84): undefined reference to `cv::FileNodeIterator::operator*() const'
CMakeFiles/aruco_gridboard.dir/src/node.cpp.o: In function `cv::internal::VecReaderProxy<float, 1>::operator()(std::vector<float, std::allocator<float> >&, unsigned long) const':
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm[_ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm]+0x34): undefined reference to `cv::FileNodeIterator::remaining() const'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm[_ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm]+0xa0): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm[_ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm]+0x134): undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
node.cpp:(.text._ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm[_ZNK2cv8internal14VecReaderProxyIfLi1EEclERSt6vectorIfSaIfEEm]+0x1e0): undefined reference to `cv::FileNodeIterator::readRaw(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void*, unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/bba/ROS_ARDU_ws/devel/.private/aruco_gridboard/lib/aruco_gridboard/aruco_gridboard] Error 1
make[1]: *** [CMakeFiles/aruco_gridboard.dir/all] Error 2
make: *** [all] Error 2
cd /home/bba/ROS_ARDU_ws/build/aruco_gridboard; catkin build --get-env aruco_gridboard | catkin env -si  /usr/bin/make --jobserver-fds=3,4 -j; cd -

When I search about the issue, I saw that could be openCV version confusion , to understand the which CV version that I have fistrly I got from terminal like:

dpkg -l | grep opencv
ii  libopencv                                  4.1.1-2-gd5a58aa75                         arm64        Open Computer Vision Library
ii  libopencv-calib3d3.2:arm64                 3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Camera Calibration library
ii  libopencv-contrib3.2:arm64                 3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision contrlib library
ii  libopencv-core3.2:arm64                    3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision core library
ii  libopencv-dev                              4.1.1-2-gd5a58aa75                         arm64        Development files for Open Source Computer Vision Library
ii  libopencv-features2d3.2:arm64              3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Feature Detection and Descriptor Extraction library
ii  libopencv-flann3.2:arm64                   3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Clustering and Search in Multi-Dimensional spaces library
ii  libopencv-highgui3.2:arm64                 3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision High-level GUI and Media I/O library
ii  libopencv-imgcodecs3.2:arm64               3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Image Codecs library
ii  libopencv-imgproc3.2:arm64                 3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Image Processing library
ii  libopencv-ml3.2:arm64                      3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Machine Learning library
ii  libopencv-objdetect3.2:arm64               3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Object Detection library
ii  libopencv-photo3.2:arm64                   3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision computational photography library
ii  libopencv-shape3.2:arm64                   3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision shape descriptors and matchers library
ii  libopencv-stitching3.2:arm64               3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision image stitching library
ii  libopencv-superres3.2:arm64                3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Super Resolution library
ii  libopencv-video3.2:arm64                   3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Video analysis library
ii  libopencv-videoio3.2:arm64                 3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision Video I/O library
ii  libopencv-videostab3.2:arm64               3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision video stabilization library
ii  libopencv-viz3.2:arm64                     3.2.0+dfsg-4ubuntu0.1                      arm64        computer vision 3D data visualization library
ii  python-opencv                              3.2.0+dfsg-4ubuntu0.1                      arm64        Python bindings for the computer vision library
ii  python3-opencv

then in another terminal:

~$ python
Python 2.7.17 (default, Mar 18 2022, 13:21:42) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
cv2>>> cv2.__version__
'4.4.0'
>>>

If I understood right, I have three version of openCV but I don’t know which one is using from where?
4.4 for what and If I have 3.2 why I cannot make catkin build? and what about 4.1 version, could you explain as simple as possible, because I am newbie about which version is using where and their purpose etc.

Hi,
By default it is 4.1.1. And a user has shared a script to build OpenCV manually:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

Please check if you can use the script to purge defautl package and build/install 3.2.

this is not the answer. I try to use opencv3.2 and I am not sure is it available or not to use with ROS Melodic. and if it is not how can I install 3.2 without removing default.

Hi,
We don’t have much experience on this and would need other user’s help. Have see some relevant pages and please take a look:
Robot Operating System ROS on NVIDIA Jetson | Robot Operating System ROS | RidgeRun
Install ROS on Jetson Nano - JetsonHacks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.