No such file or directory : geometry_msgs/Point32

Hi Construct Team,
I have a trouble to compile action interface:

---
geometry_msgs/Point32[] list_of_odoms
---
float32 current_total

I read this post: colcon build fails - environment dependency requirement
to solve this issue (removed msg from the address).

However, another error occurred:

fatal error: geometry_msgs/msg/detail/point32__struct.hpp: No such file or directory
  127 | #include "geometry_msgs/msg/detail/point32__struct.hpp"

.
But this file exists and I accessed to see whats going on.
And saw this clang error : not_found
This seems to affect following code either as you can see below.

.
I also checked geometry_msgs/msg/detail/point__struct.hpp
which is very similar to that point32 file.
And this file doesnt have any issue to link cpp files.


.
Not sure if the clang error caused a build error of action interface.
Could you have a look?

Hi @reiko.iwamoto ,

Please don’t consider the error warnings produced by the IDE. The IDE cannot find certain files and functions even if they are defined and present. The only errors you should take into notice are the ones produced during colcon build.

You can not and should not change any installed files. So knowing those files are present is good, but trying to make any changes to those files would be a bad idea.

What error does your colcon build report? Could you copy-paste the complete compilation error outputs here?
Also, please post your CMakeLists.txt file contents as a Markdown formatted text.

You can use Pose2D instead of Point or Point32 message type.

Regards,
Girish

Hi @girishkumar.kannan,
Yup, i thought it would be very bad idea to touch these files.
So no worries, i did care very much about no change.
Below is the whole error message i got:

user:~/ros2_ws$ colcon build --packages-select rosject_msg
Starting >>> rosject_msg
--- stderr: rosject_msg
In file included from /home/user/ros2_ws/build/rosject_msg/rosidl_typesupport_introspection_cpp/rosject_msg/action/detail/odom_record__type_support.cpp:12:
/home/user/ros2_ws/build/rosject_msg/rosidl_generator_cpp/rosject_msg/action/detail/odom_record__struct.hpp:127:10: fatal error: geometry_msgs/msg/detail/point32__struct.hpp: No such file or directory
  127 | #include "geometry_msgs/msg/detail/point32__struct.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/build.make:119: CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/rosidl_typesupport_introspection_cpp/rosject_msg/action/detail/odom_record__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:369: CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< rosject_msg [3.42s, exited with code 2]

Summary: 0 packages finished [3.67s]
  1 package failed: rosject_msg
  1 package had stderr output: rosject_msg
user:~/ros2_ws$

CMakeLists is following:

cmake_minimum_required(VERSION 3.8)
project(rosject_msg)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(action_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
  "srv/FindWall.srv"
  "action/OdomRecord.action"
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

Hi @reiko.iwamoto ,

I think you have forgotten to include geometry_msgs as a dependency in your rosject_msg package.
Also include geometry_msgs and nav_msgs as dependencies to your main package.

You need to edit the CMakeLists.txt and package.xml files of each package to include the above dependencies.

That should solve your problem. Let me know if you still have issues after doing the above steps in this post.

Regards,
Girish

Hi @girishkumar.kannan
I had checked CMakeLists and package.xml many times.
I included nav_msgs since it include geometry_msgs as well,
but it didnt work, so i removed from this interface for now.

Below is packages.xml.

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>rosject_msg</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="user@todo.todo">user</maintainer>
  <license>TODO: License declaration</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>rclcpp</depend>
  <depend>std_msgs</depend>
  <depend>action_msgs</depend>
  <depend>geometry_msgs</depend>
  <depend>rosidl_default_generators</depend>

  <exec_depend>rosidl_default_runtime</exec_depend>
  <member_of_group>rosidl_interface_packages</member_of_group>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Hi @reiko.iwamoto ,

I just saw your CMakeLists.txt file for rosject_msg package (since you posted it late).
If you are using ROS2 Galactic or Humble, you should also include the following line in the rosidl_generate_interfaces() block in your CMakeLists.txt file:

rosidl_generate_interfaces(${PROJECT_NAME}
  "srv/FindWall.srv"
  "action/OdomRecord.action"
  DEPENDENCIES std_msgs geometry_msgs   # <--- add this line
)

Try this and let me know.

Regards,
Girish

Hi @girishkumar.kannan,
Thank you for the advice.
I got another error now…

user:~/ros2_ws$ colcon build --packages-select rosject_msg
Starting >>> rosject_msg
--- stderr: rosject_msg
CMake Error at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:162 (message):
  rosidl_generate_interfaces() the passed dependency 'geometry_msg' has not
  been found before using find_package()
Call Stack (most recent call first):
  CMakeLists.txt:26 (rosidl_generate_interfaces)


gmake: *** [Makefile:963: cmake_check_build_system] Error 1
---
Failed   <<< rosject_msg [1.49s, exited with code 2]

Summary: 0 packages finished [1.71s]
  1 package failed: rosject_msg
  1 package had stderr output: rosject_msg
user:~/ros2_ws$

Thought the order of installing package was issue.
But it didnt work as expected.

Hi @reiko.iwamoto ,

You have typed geometry_msg instead of geometry_msgs.

Please read the error and try to understand what it says before posting it as an error here.

Fix that package name error and you should be fine.

Regards,
Girish

1 Like

@girishkumar.kannan
Thank you so much!! It compiled now!

Hi @reiko.iwamoto ,

Glad to know that your problem is resolved.

Please mark the solution and this thread can be closed.

Thanks.

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