Skip to content

Introspection fails on some systems #131

Closed

Description

@Flova

We get the following error on some of our systems:

error[E0609]: no field data on type r2r_rcl::rosidl_message_type_support_t
--> /home/lea/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/r2r_msg_gen-0.9.5/src/lib.rs:136:26
|
136 | let members = (*ptr).data as *const rosidl_typesupport_introspection_c__MessageMembers;
| ^^^^ unknown field
|
= note: available field is: _address

My college noticed it and made a patch here: bit-bots/bitbots_main#944 (comment)

I could reproduce it under Ubuntu 26.04

Is this issue already known?

Activity

  1. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    I'm also experiencing this issue, under Ubuntu 24.04.4 LTS with ROS Jazzy. I don't experience this issue on Ubuntu 18.04.6 LTS with ROS Foxy. Same bindgen version for both (0.71.1).

    Based on some early debugging steps it looks to me like this is a bindgen bug that has somehow been triggered by more recent versions of Ubuntu? I generated the combined header file and it doesn't look like it has anything wrong with it?

  2. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    Ooo. Debugging of bindgen got me one step closer to understanding the problem. The internal generated value for the Type is wrong somehow. Here's what I see in the bindgen debug logs for the item:

                Some(
                    Item {
                        id: ItemId(
                            11133,
                        ),
                        local_id: OnceCell(
                            <uninit>,
                        ),
                        next_child_local_id: Cell {
                            value: 1,
                        },
                        canonical_name: OnceCell(
                            <uninit>,
                        ),
                        path_for_allowlisting: OnceCell(
                            [
                                "root",
                                "rosidl_message_type_support_t",
                            ],
                        ),
                        comment: Some(
                            "/// Contains rosidl message type support data",
                        ),
                        annotations: Annotations {
                            opaque: false,
                            hide: false,
                            use_instead_of: None,
                            disallow_copy: false,
                            disallow_debug: false,
                            disallow_default: false,
                            must_use_type: false,
                            visibility_kind: None,
                            accessor_kind: None,
                            constify_enum_variant: false,
                            derives: [],
                            attributes: [],
                        },
                        parent_id: ItemId(
                            0,
                        ),
                        kind: Type(
                            Type {
                                name: Some(
                                    "rosidl_message_type_support_t",
                                ),
                                layout: Some(
                                    Layout {
                                        size: 48,
                                        align: 8,
                                        packed: false,
                                    },
                                ),
                                kind: Comp(
                                    CompInfo {
                                        kind: Struct,
                                        fields: After {
                                            fields: [],
                                            has_bitfield_units: false,
                                        },
                                        template_params: [],
                                        methods: [],
                                        constructors: [],
                                        destructor: None,
                                        base_members: [],
                                        inner_types: [],
                                        inner_vars: [],
                                        has_own_virtual_method: false,
                                        has_destructor: false,
                                        has_nonempty_base: false,
                                        has_non_type_template_params: false,
                                        has_unevaluable_bit_field_width: false,
                                        packed_attr: false,
                                        found_unknown_attr: false,
                                        is_forward_declaration: false,
                                    },
                                ),
                                is_const: false,
                            },
                        ),
                        location: Some(
                            /opt/ros/jazzy/install/include/rosidl_runtime_c/rosidl_runtime_c/message_type_support_struct.h:44:8,
                        ),
                    },
                ),
    
  3. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    I should add that I'm using libclang-22-dev. Not sure if that's causing trouble with bindgen :/

  4. Flova commented on Aug 28, 2026

    @Flova
    Author

    I think the linked issue might have a fix/patch, but I haven't tried it.

  5. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    This looks to be the underlying bindgen issue: rust-lang/rust-bindgen#2691

  6. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    I believe the linked issue fixes it by not using bindgen to generate this type, but instead providing a built-in type for rosidl_message_type_support_t that has a fixed structure (without the function pointers). This will technically work, but fixing the underlying bindgen issue is likely the smarter choice for this project?

  7. evandjpl commented on Aug 28, 2026

    @evandjpl
    Contributor

    Great news!

    1. That was the wrong bindgen issue to link to. Below are a selection of issues I found that actually describe the issue
    2. This issue is fixed in bindgen 0.72.1!

    I'm going to make a PR requesting we bump the bindgen version to allow people with LLVM newer than 20 to continue using r2r.

    Issues + PRs:
    rust-lang/rust-bindgen#370
    rust-lang/rust-bindgen#3377
    rust-lang/rust-bindgen#3376
    rust-lang/rust-bindgen#3264
    rust-lang/rust-bindgen#3278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions