Skip to content

EcCiA402Drive plugin fails to load at runtime (missing yaml-cpp linkage) #219

Description

@apajon

Hi,

I ran into an issue on ROS 2 Jazzy (Ubuntu 24.04) where the EcCiA402Drive plugin fails to load at runtime.

After digging a bit, it turns out both ethercat_generic_slave and ethercat_generic_cia402_drive are built without linking yaml-cpp, which leads to a dlopen failure when pluginlib tries to load the plugin.

I couldn’t find a similar issue reported, so sharing this in case others hit the same problem on Jazzy.


Error

[FATAL] [EthercatDriver]: The plugin of platform_to_moving_base failed to load.
Error: Failed to load library .../libethercat_generic_cia402_drive.so.
Error string:
  .../libethercat_generic_slave.so: undefined symbol: _ZTIN4YAML13BadConversionE

Demangled, this is:

typeinfo for YAML::BadConversion

So clearly a missing yaml-cpp symbol at link time.


What I checked

ldd libethercat_generic_slave.so | grep yaml
# nothing

ldd libethercat_generic_cia402_drive.so | grep yaml
# nothing

So neither library is linked against yaml-cpp.


Root cause (likely)

Both packages rely on:

find_package(yaml_cpp_vendor REQUIRED)
ament_target_dependencies(... yaml_cpp_vendor)

But on Jazzy, yaml_cpp_vendor only sets yaml-cpp_DIR and does not:

  • call find_package(yaml-cpp)
  • export any targets
  • propagate any link libraries

So:

  • headers are found → build succeeds
  • no actual linkage → runtime crash

Fix

Adding an explicit yaml-cpp dependency fixes it.

ethercat_generic_slave

find_package(yaml_cpp_vendor REQUIRED)
find_package(yaml-cpp REQUIRED)

ament_target_dependencies(
  ethercat_generic_slave
  ethercat_interface
  pluginlib
  yaml_cpp_vendor
)

target_link_libraries(
  ethercat_generic_slave
  yaml-cpp::yaml-cpp
)

ethercat_generic_cia402_drive

find_package(yaml_cpp_vendor REQUIRED)
find_package(yaml-cpp REQUIRED)

ament_target_dependencies(
  ethercat_generic_cia402_drive
  ethercat_interface
  ethercat_generic_slave
  pluginlib
  yaml_cpp_vendor
)

target_link_libraries(
  ethercat_generic_cia402_drive
  yaml-cpp::yaml-cpp
)

Result

After that:

ldd libethercat_generic_slave.so | grep yaml
→ libyaml-cpp.so

ldd libethercat_generic_cia402_drive.so | grep yaml
→ libyaml-cpp.so

And the plugin loads correctly.


Note

This might also be a limitation / bug in yaml_cpp_vendor, but adding the explicit dependency here seems like the safest fix anyway.

Edit: reported by my main account (@apajon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions