catkin_make not working after VS Code ROS extension debug setup
Hi,
I installed today the VS Code ROS extension, in order to try to debug my code for a ROS node for RGB-D Odometry using OpenCV, which is generating segmentation error (core dumped) when running. I made several changes followed by catkin_make yesterday, until I decided to try a debugger. The only change I made today was to config the ROS extension, as per this tutorial.
After some unsuccessful trials to find the issue with the debugger, I tried to make one change in my code, and build again. And I am now having the following error:
-- +++ processing catkin package: 'test_opencv_pkg'
-- ==> add_subdirectory(test_opencv_pkg)
-- Could NOT find OpenCV (missing: OpenCV_DIR)
-- Could not find the required component 'OpenCV'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
test_opencv_pkg/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
...
Makefile:754: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
I could not understand very well by the error log what can be done for fixing it. Appreciate if some can help to fix it.
Thanks.
Edit:
Adding CMakeLists.txt from my OpenCV Package. I could also notice that after trying build/debug with the mentioned VS Code stuff, I now have lots of new folders/files inside the package folder, such as "catkin", "catkin_generated", "test_results", "CMakeCache.txt", "CTestConfiguration.ini"...
cmake_minimum_required(VERSION 3.0.2)
project(test_opencv_pkg)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
rospy
roscpp
image_transport
sensor_msgs
std_msgs
OpenCV
)
if (OpenCV_FOUND)
message("Find your opencv succesfully")
else()
message("Cannot find your opencv, please specifiy your opencv path")
set(OpenCV_INCLUDE_DIRS /opt/opencv/release/include)
set(OpenCV_LIBS opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_calib3d)
link_directories(/opt/opencv/release/lib)
endif()
catkin_package()
include_directories(${catkin_INCLUDE_DIRS}
)
add_executable(opencv_node src/cv_test.cpp)
add_executable(optflow src/optflow.cpp)
add_executable(harris1 src/harris1.cpp)
add_executable(harris2 src/harris1.cpp)
add_executable(opencv_node2 src/cv_test2.cpp)
add_executable(rgbd_odometry src/rgbd_odo.cpp)
target_link_libraries(opencv_node
${catkin_LIBRARIES}
)
target_link_libraries(opencv_node2
${catkin_LIBRARIES}
)
target_link_libraries(rgbd_odometry
${catkin_LIBRARIES}
)
target_link_libraries(optflow
${catkin_LIBRARIES}
)
target_link_libraries(harris1
${catkin_LIBRARIES}
)
target_link_libraries(harris2
${catkin_LIBRARIES}
)