0
$\begingroup$

Rosanswers logo

I'm attempt to build a package with a custom action, but it fails with an error Could NOT find FastRTPS (missing: FastRTPS_INCLUDE_DIR FastRTPS_LIBRARIES). Please find full colon output below.

Google points me out to this fix and with export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH:$CMAKE_PREFIX_PATH it works. Is it an issue I have to report to some repository or it's something missed in my CMakeLists.txt or package.xml files?

$colcon build --packages-select my_package
Starting >>> my_package
--- stderr: my_package
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find FastRTPS (missing: FastRTPS_INCLUDE_DIR FastRTPS_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /opt/ros/dashing/share/fastrtps_cmake_module/cmake/Modules/FindFastRTPS.cmake:95 (find_package_handle_standard_args)
  /opt/ros/dashing/share/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c-extras.cmake:7 (find_package)
  /opt/ros/dashing/share/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_cConfig.cmake:38 (include)
  /opt/ros/dashing/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
  /opt/ros/dashing/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:38 (include)
  CMakeLists.txt:6 (find_package)


---
Failed   <<< my_package       [ Exited with code 1 ]

Summary: 0 packages finished [0.82s]
  1 package failed: my_package
  1 package had stderr output: my_package

Originally posted by khassanov on ROS Answers with karma: 31 on 2019-10-04

Post score: 3


Original comments

Comment by gvdhoorn on 2019-10-04:\

it's something missed in my CMakeLists.txt or package.xml files?

that would be difficult to determine, seeing as you don't show us either of those files.

But I don't believe this is a problem in your package, but in your environment.

You'll probably have to describe how you installed ROS, how you normally activate/setup your workspace and whether you get this error with all packages that try to build messages or just this particular one.

Comment by lobby on 2019-11-29:
Hi there, i encounted the same problem today, I saw your solution and solved my problem. Thanks.

it's something missed in my CMakeLists.txt or package.xml files?

I dont think so.
I have installed ROS2 binary and ROS2 source code in my PC.
Before i run the colcon build steps, i source the ROS2 binary path:source /opt/ros/dashing/setup.bash, then i check the AMENT_PREFIX_PATH and CMAKE_PREFIX_PATH variables.The AMENT_PREFIX_PATH=/opt/ros/dashing, while the CMAKE_PREFIX_PATH has empty value, so the colcon build was failed.
But if i source the ROS2 source code path source ~/ros2_ws/install/local_setup.bash, then the variable AMENT_PREFIX_PATH and CMAKE_PREFIX_PATH have the same value. so the problem may result from that you installed the ROS2 binary version.

Back to the point. what cause the difference between the above phenomenon. i still have no idea....

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

Please see https://github.com/ros2/rosidl_typesupport_fastrtps/pull/56 for a proper fix to this issue.


Originally posted by Dirk Thomas with karma: 16276 on 2020-10-09

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

Since there's no answer, I might as well post a workaround based on this link from the official Intellij Support Forum.

You can add in your CMakeLists.txt before the find_package() macros the following:

set(FastRTPS_INCLUDE_DIR /opt/ros/foxy/include) 
set(FastRTPS_LIBRARY_RELEASE /opt/ros/foxy/lib/libfastrtps.so)

Originally posted by anas9011 with karma: 11 on 2020-09-01

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

My workaround is to add this in your .bashrc:

export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH   

This way I don't need to change any project files.

You could also add the cmake path: ( but Ament already has all the cmake paths in my system )

export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH:$CMAKE_PREFIX_PATH

Originally posted by madmax with karma: 496 on 2020-10-09

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.