UniversalRobots / Universal_Robots_Client_Library

A C++ library for accessing the UR interfaces that facilitate the use of UR robotic manipulators by external applications.
Apache License 2.0
117 stars 86 forks source link

Compilation failure with clang #209

Closed remi-siffert-ocado closed 1 month ago

remi-siffert-ocado commented 1 month ago

Affected Client Library version(s)

1.3.7

What combination of platform is the Client Library running on.

Linux

How did you install the Client Library

Build the library from source

Which robot platform is the library connected to.

URSim in docker

Robot SW / URSim version(s)

5.16.0

How are you using the Client Library

Through the robot teach pendant using External Control URCap

Issue details

Summary

The library cannot be compiled with clang because of an error in the full driver example.

Issue details

The following line in full_driver.cpp fails to compile with:

universal_robots_client_library/examples/full_driver.cpp:163:39: error: cannot pass object of non-trivial type 'std::string' (aka 'basic_string<char>') through variadic function; call will abort at runtime [-Wnon-pod-varargs] URCL_LOG_DEBUG("data_pkg:\n%s", data_pkg->toString());

Steps to Reproduce

Expected Behavior

The library should compile successfully with gcc and clang.

Actual Behavior

The library compiles successfully with gcc but fails to compile with clang.

Workaround Suggestion

Replacing URCL_LOG_DEBUG("data_pkg:\n%s", data_pkg->toString()); with URCL_LOG_DEBUG("data_pkg:\n%s", data_pkg->toString().c_str()); does the trick. Happy to open a PR for this.

Relevant log output

No response

Accept Public visibility

fmauch commented 1 month ago

This seems fair, thank you! Would you like to provide a PR so it is attributed with you?

remi-siffert-ocado commented 1 month ago

PR https://github.com/UniversalRobots/Universal_Robots_Client_Library/pull/210 is open for review.