catkin can't find geometry_msgs even though it's on CMAKE_PREFIX_PATH
I have run sudo apt install -y ros-geometry-msgs
, but when I try to build my project with it, I get this error:
CMake Error at /opt/ros/noetic/share/genmsg/cmake/genmsg-extras.cmake:271 (message):
Could not find 'share/geometry_msgs/cmake/geometry_msgs-msg-paths.cmake'
(searched in '/home/tjpowell/Robot_files/RobotCodeRospy/test3/devel;
/home/tjpowell/Robot_files/RobotCodeRoscpp/test3/devel;/opt/ros/noetic').
echo $CMAKE_PREFIX_PATH
:
/home/tjpowell/Robot_files/RobotCodeRospy/test3/devel:
/home/tjpowell/Robot_files/RobotCodeRoscpp/test3/devel:
/opt/ros/noetic:
/usr/share/geometry_msgs/cmake
When I print $CMAKE_PREFIX_PATH
at the beginning of CMakeLists.txt
using cmake_print_variables
, it gives the above value as well, with /usr/share/geometry_msgs/cmake
.
ls /usr/share/geometry_msgs/cmake
:
geometry_msgs-msg-extras.cmake geometry_msgs-msg-paths.cmake geometry_msgsConfig-version.cmake geometry_msgsConfig.cmake
package.xml
:
<?xml version="1.0"?>
<package format="2">
<name>test3_abhi</name>
<version>0.0.0</version>
<description>The test3_abhi package</description>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<build_export_depend>message_runtime</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>message_runtime</exec_depend>
<export>
</export>
</package>
My CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.2)
project(test3_abhi)
include(CMakePrintHelpers)
set (geometry_msgs_DIR "/usr/share/geometry_msgs/cmake")
cmake_print_variables(CMAKE_PREFIX_PATH)
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation geometry_msgs )
## * add a build_depend
add_service_files( FILES TSP.srv )
## Generate added messages and services with any dependencies listed here
generate_messages( DEPENDENCIES std_msgs geometry_msgs )
catkin_package( INCLUDE_DIRS include # LIBRARIES test3_abhi CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs message_runtime # DEPENDS system_lib )
include_directories( # include ${catkin_INCLUDE_DIRS} )
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-fopenmp")
add_compile_options( -I/opt/ros/noetic/include -I/usr/local/include/dynamixel-sdk)
add_executable(test3_printemo src/test3_printemo.cpp include/abhi.cpp)
target_link_libraries(test3_printemo ${catkin_LIBRARIES} #${OpenCV_LIBS} Qt5Widgets Qt5Gui Qt5Test Qt5Concurrent Qt5Core dxl_x64_cpp boost_system pcl_visualization pcl_common pthread phidget21 realsense2 hdf5_serial blas hdf5_serial_hl boost_filesystem boost_thread opencv_highgui opencv_ximgproc opencv_photo opencv_calib3d opencv_imgcodecs opencv_imgproc opencv_core)
add_executable(tsp src/TSPSrv.cpp include/abhi.cpp)
target_link_libraries(tsp ${catkin_LIBRARIES} #${OpenCV_LIBS} Qt5Widgets Qt5Gui Qt5Test Qt5Concurrent Qt5Core dxl_x64_cpp boost_system pcl_visualization pcl_common pthread phidget21 realsense2 hdf5_serial blas hdf5_serial_hl boost_filesystem boost_thread opencv_highgui opencv_ximgproc opencv_photo opencv_calib3d opencv_imgcodecs opencv_imgproc opencv_core)
@TheAlmightySand: Welcome to ROS Answers. You do not need to close your question upon receiving the answer. Instead, you upvote and click on the checkmark ✓ to accept the correct answer. You have already accepted the correct answer below. Therefore, please ignore my message. Just remember not to close your questions in the future.