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

rosidl_typesupport_c assumes shared library names are called "<package name>__<typesupport name>" #120

Open
sloretz opened this issue Jan 12, 2022 · 5 comments
Labels
backlog bug Something isn't working

Comments

@sloretz
Copy link
Contributor

sloretz commented Jan 12, 2022

Bug report

Required Info:

  • Operating System:
    • Focal
  • Installation type:
    • source
  • Version or commit hash:
    • Latest
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • rcl

Steps to reproduce issue

Expected behavior

All of rcl's tests would pass

Actual behavior

Many tests fail with

85: [ RUN      ] TestSubscriptionFixture__rmw_fastrtps_dynamic_cpp.test_subscription_init_fini_and_is_valid
85: /home/osrf/ws/ros2/src/ros2/rcl/rcl/test/rcl/test_subscription.cpp:135: Failure
85: Expected equality of these values:
85:   0
85:   ret
85:     Which is: 1
85: Type support not from this implementation. Got:
85:     Could not load library libtest_msgs__rosidl_typesupport_introspection_c.so: dlopen error: libtest_msgs__rosidl_typesupport_introspection_c.so: cannot open shared object file: No such file or directory, at /home/osrf/ws/ros2/src/ros2/rcutils/src/shared_library.c:99, at /home/osrf/ws/ros2/src/ros2/rosidl_typesupport/rosidl_typesupport_c/src/type_support_dispatch.hpp:78
85:     Handle's typesupport identifier (rosidl_typesupport_c) is not supported by this library, at /home/osrf/ws/ros2/src/ros2/rosidl_typesupport/rosidl_typesupport_c/src/type_support_dispatch.hpp:113
85: while fetching it, at /home/osrf/ws/ros2/src/ros2/rmw_fastrtps/rmw_fastrtps_dynamic_cpp/src/subscription.cpp:117, at /home/osrf/ws/ros2/src/ros2/rcl/rcl/src/rcl/subscription.c:105
85: [  FAILED  ] TestSubscriptionFixture__rmw_fastrtps_dynamic_cpp.test_subscription_init_fini_and_is_valid (7 ms)
85: [ RUN      ] TestSubscriptionFixture__rmw_fastrtps_dynamic_cpp.test_subscription_bad_init

All failures:

	  7 - test_client__rmw_cyclonedds_cpp (Failed)
	 14 - test_graph__rmw_cyclonedds_cpp (Failed)
	 15 - test_info_by_topic__rmw_cyclonedds_cpp (Failed)
	 16 - test_count_matched__rmw_cyclonedds_cpp (Failed)
	 17 - test_get_actual_qos__rmw_cyclonedds_cpp (Failed)
	 22 - test_remap_integration__rmw_cyclonedds_cpp (Failed)
	 24 - test_publisher__rmw_cyclonedds_cpp (Failed)
	 25 - test_publisher_wait_all_ack__rmw_cyclonedds_cpp (Failed)
	 26 - test_service__rmw_cyclonedds_cpp (Failed)
	 27 - test_subscription__rmw_cyclonedds_cpp (Failed)
	 28 - test_events__rmw_cyclonedds_cpp (Failed)
	 31 - test_namespace__rmw_cyclonedds_cpp (Failed)
	 33 - test_network_flow_endpoints__rmw_cyclonedds_cpp (Failed)
	 34 - test_services__rmw_cyclonedds_cpp (Failed)
	 36 - test_client__rmw_fastrtps_cpp (Failed)
	 43 - test_graph__rmw_fastrtps_cpp (Failed)
	 44 - test_info_by_topic__rmw_fastrtps_cpp (Failed)
	 45 - test_count_matched__rmw_fastrtps_cpp (Failed)
	 46 - test_get_actual_qos__rmw_fastrtps_cpp (Failed)
	 51 - test_remap_integration__rmw_fastrtps_cpp (Failed)
	 53 - test_publisher__rmw_fastrtps_cpp (Failed)
	 54 - test_publisher_wait_all_ack__rmw_fastrtps_cpp (Failed)
	 55 - test_service__rmw_fastrtps_cpp (Failed)
	 56 - test_subscription__rmw_fastrtps_cpp (Failed)
	 57 - test_events__rmw_fastrtps_cpp (Failed)
	 60 - test_namespace__rmw_fastrtps_cpp (Failed)
	 62 - test_network_flow_endpoints__rmw_fastrtps_cpp (Failed)
	 63 - test_services__rmw_fastrtps_cpp (Failed)
	 65 - test_client__rmw_fastrtps_dynamic_cpp (Failed)
	 72 - test_graph__rmw_fastrtps_dynamic_cpp (Failed)
	 73 - test_info_by_topic__rmw_fastrtps_dynamic_cpp (Failed)
	 74 - test_count_matched__rmw_fastrtps_dynamic_cpp (Failed)
	 75 - test_get_actual_qos__rmw_fastrtps_dynamic_cpp (Failed)
	 80 - test_remap_integration__rmw_fastrtps_dynamic_cpp (Failed)
	 82 - test_publisher__rmw_fastrtps_dynamic_cpp (Failed)
	 83 - test_publisher_wait_all_ack__rmw_fastrtps_dynamic_cpp (Failed)
	 84 - test_service__rmw_fastrtps_dynamic_cpp (Failed)
	 85 - test_subscription__rmw_fastrtps_dynamic_cpp (Failed)
	 86 - test_events__rmw_fastrtps_dynamic_cpp (Failed)
	 89 - test_namespace__rmw_fastrtps_dynamic_cpp (Failed)
	 91 - test_network_flow_endpoints__rmw_fastrtps_dynamic_cpp (Failed)
	 92 - test_services__rmw_fastrtps_dynamic_cpp (Failed)

Additional information

I don't fully understand what's going on, but I'm pretty sure this code is wrong. It assumes the library name for a typesupport target is going to be "__", but that's an incorrect assumption. The first part is the target name passed to rosidl_generate_interfaces, not the package name.

int ret = rcutils_snprintf(
library_basename, 1023, "%s__%s",
map->package_name, identifier);

@sloretz
Copy link
Contributor Author

sloretz commented Jan 27, 2022

IIUC from @hidmic , the instrospection typesupport assumes the library is named the same as the package in more places than this.

A temporary workaround would be to warn in rosidl_generate_interfaces() if the passed target name is anything other than ${PROJECT_NAME} with a link to this issue.

@sloretz sloretz removed their assignment Jan 27, 2022
@hidmic
Copy link
Contributor

hidmic commented Jan 27, 2022

@sloretz To add to this, I even added a macro quite recently to put together the library name given how often we do it elsewhere.

If we want to generalize library naming (and propagate them as a map? so downstream can fetch the right library for a given package), we have to make changes here and downstream. Otherwise, I agree that enforcing the name would be best.

@sloretz
Copy link
Contributor Author

sloretz commented Feb 2, 2022

Similar issue in the past ros2/rosidl_python#11

sloretz added a commit to sloretz/drake-ros that referenced this issue Jun 13, 2023
sloretz added a commit to RobotLocomotion/drake-ros that referenced this issue Jun 20, 2023
* Workaround ros2/rosidl_typesupport#120

* XXX Test that rosidl_generate_interfaces() works with group

* Revert "XXX Test that rosidl_generate_interfaces() works with group"

This reverts commit 182bd85.

* fixup - pass kwargs to alias targets
@felixf4xu
Copy link

felixf4xu commented Aug 17, 2023

I'm having the same issue but my case is a little different.

I am using msg from the same package.
My exe is named by package name like this:

    add_executable(${PROJECT_NAME} src/pcl_mapping.cpp)

then I generate the msg lib in the same cmake file, I have to change the lib name to another name (here by adding _msg because the target name is already used by my exe (this is a cmake rule):

    rosidl_generate_interfaces(${PROJECT_NAME}_msg

then this will lead to the exactly same error message as reported by this issue.

@furkansariyildiz
Copy link

Hi, I had same issue with you and I solved it. rosidl_generate_interfaces(${PROJECT_NAME}_msg remove _msg from ${PROJECT_NAME} and if your node name is ${PROJECT_NAME}, change it also. You can check my CMakeList.txt from this repo: roboteq_motor_controller_driver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants