BehaviorTree / BehaviorTree.ROS2

BehaviorTree.CPP utilities to work with ROS2
Apache License 2.0
145 stars 60 forks source link

Fail to compile sleep_client.cpp with latest master of BT.CPP #15

Closed ErickKramer closed 1 year ago

ErickKramer commented 1 year ago

The changes introduced by https://github.com/BehaviorTree/BehaviorTree.CPP/commit/77c0571eb244ca39808ee521fd82839eb643a9f8 broke this package.

While compiling I get the following error

Starting >>> behaviortree_ros2
--- stderr: behaviortree_ros2
/usr/bin/ld: CMakeFiles/sleep_client.dir/test/sleep_client.cpp.o: in function `std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, BT::PortInfo> BT::InputPort<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string_view<char, std::char_traits<char> >)':
sleep_client.cpp:(.text._ZN2BT9InputPortINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt4pairIS6_NS_8PortInfoEESt17basic_string_viewIcS4_ERKT_SB_[_ZN2BT9InputPortINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt4pairIS6_NS_8PortInfoEESt17basic_string_viewIcS4_ERKT_SB_]+0x7d): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > BT::toStr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/sleep_client.dir/build.make:172: sleep_client] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:711: CMakeFiles/sleep_client.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< behaviortree_ros2 [2.97s, exited with code 2]

From what I can see, it seems that the way the providedBasicPorts was generated is not valid anymore.

If I change the InputPort definition like this:

-      InputPort<std::string>("action_name", "__default__placeholder__", "Action server name")
+      InputPort<std::string>("action_name", "Action server name")

the issue is fixed and no side effects are present.