小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
colcon build 编译出现错误
-
主要出现错误:WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces,不太理解为什么
[8.207s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'examples_rclpy_executors' is in: /opt/ros/foxy
'examples_rclcpp_minimal_publisher' is in: /opt/ros/foxy
'examples_rclpy_minimal_subscriber' is in: /opt/ros/foxy
'examples_rclpy_minimal_action_server' is in: /opt/ros/foxy
'examples_rclcpp_multithreaded_executor' is in: /opt/ros/foxy
'examples_rclcpp_minimal_composition' is in: /opt/ros/foxy
'examples_rclpy_minimal_publisher' is in: /opt/ros/foxy
'examples_rclcpp_minimal_service' is in: /opt/ros/foxy
'examples_rclcpp_minimal_action_client' is in: /opt/ros/foxy
'examples_rclcpp_minimal_subscriber' is in: /opt/ros/foxy
'examples_rclcpp_minimal_timer' is in: /opt/ros/foxy
'examples_rclpy_minimal_service' is in: /opt/ros/foxy
'examples_rclpy_minimal_action_client' is in: /opt/ros/foxy
'examples_rclcpp_minimal_client' is in: /opt/ros/foxy
'examples_rclpy_minimal_client' is in: /opt/ros/foxy
'examples_rclcpp_minimal_action_server' is in: /opt/ros/foxy
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding examples_rclcpp_minimal_action_client examples_rclcpp_minimal_action_server examples_rclcpp_minimal_client examples_rclcpp_minimal_composition examples_rclcpp_minimal_publisher examples_rclcpp_minimal_service examples_rclcpp_minimal_subscriber examples_rclcpp_minimal_timer examples_rclcpp_multithreaded_executor examples_rclpy_executors examples_rclpy_minimal_action_client examples_rclpy_minimal_action_server examples_rclpy_minimal_client examples_rclpy_minimal_publisher examples_rclpy_minimal_service examples_rclpy_minimal_subscriberThis may be promoted to an error in a future release of colcon-override-check.
Starting >>> examples_rclcpp_async_client
Starting >>> examples_rclcpp_cbg_executor
Starting >>> examples_rclcpp_minimal_action_client
Starting >>> examples_rclcpp_minimal_action_server
[Processing: examples_rclcpp_async_client, examples_rclcpp_cbg_executor, examples_rclcpp_minimal_action_client, examples_rclcpp_minimal_action_server]
--- stderr: examples_rclcpp_async_client
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp: In lambda function:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:46:42: error: ‘using element_type = class rclcpp::Client<example_interfaces::srv::AddTwoInts>’ {aka ‘class rclcpp::Client<example_interfaces::srv::AddTwoInts>’} has no member named ‘prune_requests_older_than’
46 | size_t n_pruned = this->client_->prune_requests_older_than(
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/client.hpp:40,
from /opt/ros/foxy/include/rclcpp/callback_group.hpp:23,
from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:24:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp: In member function ‘void ClientNode::queue_async_request(int64_t, int64_t)’:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:103:14: error: ‘class std::shared_future<std::pair<std::shared_ptr<example_interfaces::srv::AddTwoInts_Request_<std::allocator<void> > >, std::shared_ptr<example_interfaces::srv::AddTwoInts_Response_<std::allocator<void> > > > >’ has no member named ‘request_id’
103 | result.request_id);
| ^~~~~~~~~~
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp: At global scope:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:123:6: error: ‘optional’ in namespace ‘std’ does not name a template type
123 | std::optional<int64_t>
| ^~~~~~~~
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:123:1: note: ‘std::optional’ is only available from C++17 onwards
123 | std::optional<int64_t>
| ^~~
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp: In lambda function:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:171:53: error: no matching function for call to ‘rclcpp::executors::SingleThreadedExecutor::spin_until_future_complete(const std::future<void>&)’
171 | executor.spin_until_future_complete(stop_token);
| ^
In file included from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:24:
/opt/ros/foxy/include/rclcpp/executor.hpp:194:3: note: candidate: ‘template<class ResponseT, class TimeRepT, class TimeT> rclcpp::FutureReturnCode rclcpp::Executor::spin_until_future_complete(const std::shared_future<_Res>&, std::chrono::duration<_Rep, _Period>)’
194 | spin_until_future_complete(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/foxy/include/rclcpp/executor.hpp:194:3: note: template argument deduction/substitution failed:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:171:53: note: ‘const std::future<void>’ is not derived from ‘const std::shared_future<_Res>’
171 | executor.spin_until_future_complete(stop_token);
| ^
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp: In function ‘int main(int, char**)’:
/home/ggl/colcon_test_ws/src/examples/rclcpp/services/async_client/main.cpp:175:28: error: ‘read_number’ was not declared in this scope; did you mean ‘read_more’?
175 | auto optional_number = read_number(buffer, logger);
| ^~~~~~~~~~~
| read_more
make[2]: *** [CMakeFiles/client_main.dir/build.make:63:CMakeFiles/client_main.dir/main.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:78:CMakeFiles/client_main.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2Failed <<< examples_rclcpp_async_client [34.5s, exited with code 2]
Aborted <<< examples_rclcpp_minimal_action_server [41.7s]
Aborted <<< examples_rclcpp_minimal_action_client [42.7s]
Aborted <<< examples_rclcpp_cbg_executor [56.1s]Summary: 0 packages finished [1min 5s]
1 package failed: examples_rclcpp_async_client
3 packages aborted: examples_rclcpp_cbg_executor examples_rclcpp_minimal_action_client examples_rclcpp_minimal_action_server
3 packages had stderr output: examples_rclcpp_async_client examples_rclcpp_cbg_executor examples_rclcpp_minimal_action_client
18 packages not processed