pf-robotics / kachaka-api

スマートファニチャープラットフォーム「カチャカ」API
https://kachaka.zendesk.com/hc/ja/articles/7660222791183-%E3%82%AB%E3%83%81%E3%83%A3%E3%82%ABAPI
Apache License 2.0
85 stars 24 forks source link

ROS2 colcon build error: No SOURCES given to target: kachaka_grpc_ros2_bridge #74

Open mikolodz opened 7 months ago

mikolodz commented 7 months ago

Hello, I'm having trouble building the kachaka ros2 project on Ubuntu 22.04, ROS2 Humble. I would really appreciate some help to make it working.

In .bashrc file, I'm sourcing both ros2 and kachaka ros2 libs:

...
# ROS2 Versions
source /opt/ros/humble/setup.bash
# Kachaka
source /opt/kachaka/setup.bash
...
(base) administrator@B760:~/workspaces/ros2_kachaka$ ls
src
(base) administrator@B760:~/workspaces/ros2_kachaka$ colcon build
Starting >>> kachaka_interfaces
Starting >>> kachaka_description
Starting >>> kachaka_bringup
Starting >>> kachaka_speak
Starting >>> kachaka_vision                                      
--- stderr: kachaka_speak            
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< kachaka_speak [0.75s]
Finished <<< kachaka_bringup [0.81s]
Finished <<< kachaka_description [1.51s]
--- stderr: kachaka_interfaces       
CMake Warning (dev) at /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:20 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
  CMakeLists.txt:18 (rosidl_generate_interfaces)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:52 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:23 (find_package)
  /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
  CMakeLists.txt:18 (rosidl_generate_interfaces)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:140 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:23 (find_package)
  /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
  CMakeLists.txt:18 (rosidl_generate_interfaces)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:52 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmake-extras.cmake:18 (find_package)
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmakeConfig.cmake:41 (include)
  /opt/ros/humble/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:36 (find_package)
  CMakeLists.txt:38 (ament_lint_auto_find_test_dependencies)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:140 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmake-extras.cmake:18 (find_package)
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmakeConfig.cmake:41 (include)
  /opt/ros/humble/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:36 (find_package)
  CMakeLists.txt:38 (ament_lint_auto_find_test_dependencies)
This warning is for project developers.  Use -Wno-dev to suppress it.

---
Finished <<< kachaka_interfaces [4.90s]
Starting >>> kachaka_follow
Starting >>> kachaka_grpc_ros2_bridge
Starting >>> kachaka_smart_speaker
--- stderr: kachaka_smart_speaker    
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< kachaka_smart_speaker [0.85s]
--- stderr: kachaka_follow
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< kachaka_follow [0.95s]
--- stderr: kachaka_grpc_ros2_bridge 
CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:52 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmake-extras.cmake:18 (find_package)
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmakeConfig.cmake:41 (include)
  /opt/ros/humble/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:36 (find_package)
  CMakeLists.txt:164 (ament_lint_auto_find_test_dependencies)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/ros/humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:140 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmake-extras.cmake:18 (find_package)
  /opt/ros/humble/share/launch_testing_ament_cmake/cmake/launch_testing_ament_cmakeConfig.cmake:41 (include)
  /opt/ros/humble/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:36 (find_package)
  CMakeLists.txt:164 (ament_lint_auto_find_test_dependencies)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /opt/ros/humble/share/ament_cmake_auto/cmake/ament_auto_add_library.cmake:66 (add_library):
  Cannot find source file:

    gen-src/kachaka-api.grpc.pb.cc

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc
Call Stack (most recent call first):
  CMakeLists.txt:28 (ament_auto_add_library)

CMake Error at /opt/ros/humble/share/ament_cmake_auto/cmake/ament_auto_add_library.cmake:66 (add_library):
  No SOURCES given to target: kachaka_grpc_ros2_bridge
Call Stack (most recent call first):
  CMakeLists.txt:28 (ament_auto_add_library)

CMake Generate step failed.  Build files cannot be regenerated correctly.
---
Failed   <<< kachaka_grpc_ros2_bridge [1.78s, exited with code 1]
Aborted  <<< kachaka_vision [6.74s] 

Summary: 6 packages finished [7.36s]
  1 package failed: kachaka_grpc_ros2_bridge
  1 package aborted: kachaka_vision
  6 packages had stderr output: kachaka_follow kachaka_grpc_ros2_bridge kachaka_interfaces kachaka_smart_speaker kachaka_speak kachaka_vision
youtalk-pfr commented 6 months ago

I'm sorry to be late to find your issue. The error means you forgot to call protoc to automatically generate the client codes before colcon build.

CMake Error at /opt/ros/humble/share/ament_cmake_auto/cmake/ament_auto_add_library.cmake:66 (add_library):
  Cannot find source file:

    gen-src/kachaka-api.grpc.pb.cc

Please refer the following links and generate them first.

https://github.com/pf-robotics/kachaka-api/blob/main/Dockerfile.ros2#L77-L81 https://speakerdeck.com/youtalk/jia-ting-yong-zi-lu-yi-dong-robotuto-katiyaka-nokai-fa-zhe-apigong-kai-to-ros-2intahueisushi-zhuang?slide=28