Stuck with the compilation of RTPS in a ROS2 workspace

Good Morning everyone

It’s some days already that I’m stuck on trying to use RTPS with ROS2.
After following the documentation on PX4 site to install all the dependencies (FastRTPS 1.8.2 and Fast-RTPS-Gen 1.0.4, even if when cloning from github it downloads the 1.8.4 version and if I try to explicitely download from the 1.8.2 branch it says that it doesn’t exist), I tried to compile the px4_msgs and px4_ros_com packages (I don’t need the ROS1 bridge), but I get the following error while compiling the second (for the first no problems instead):

Timesync_PubSubTypes.h: No such file or directory

#include “Timesync_PubSubTypes.h”

I tried the solutions in the topics I found here but I couldn’t solve the problem.
I checked in px4_ros_com/src/micrortps_agent folder and the file generated had not the underscore (getting the wrong Fast-RTPS-Gen version?). I tried multiple times, uninstalling every dependency and installing it again, but that error always showed up.
I then tried to download and install the versions of the dependencies specified in the px4_ros_com/scripts/setup_system.bash file (installing FastRTPS 1.8.3 and Fast-RTPS-Gen 1.0.3) and when compiling again, that error was gone…but at the end of the compilation of the package I get a series of warnings that abort the compilation and that I could not solve:

— stderr: px4_ros_com
openjdk version “11.0.7” 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
CMakeFiles/micrortps_agent.dir/build.make:353: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/Timesync.cpp’
CMakeFiles/micrortps_agent.dir/build.make:182: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/Timesync.cpp’
CMakeFiles/micrortps_agent.dir/build.make:356: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.cpp’
CMakeFiles/micrortps_agent.dir/build.make:185: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.cpp’
CMakeFiles/micrortps_agent.dir/build.make:359: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.h’
CMakeFiles/micrortps_agent.dir/build.make:188: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.h’

Could you please give me some tips?
I am working on ROS2 Dashing Diademata, ROS Melodic.
Thank you for your time, I wish you all a nice day

Andrea

Update: I uninstalled the version 11 of java openjdk and currently using the version 8, as recommended on the documentation. Done a clean install of ROS Dashing, Fast-RTPS (version 1.8.2(4)) and Fast-RTPS-Gen (version 1.0.4).
Tried then to build again and the same list of warnings appear, and I dunno how to solve them.

— stderr: px4_ros_com
CMakeFiles/micrortps_agent.dir/build.make:353: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/Timesync.cpp’
CMakeFiles/micrortps_agent.dir/build.make:182: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/Timesync.cpp’
CMakeFiles/micrortps_agent.dir/build.make:356: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.cpp’
CMakeFiles/micrortps_agent.dir/build.make:185: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.cpp’
CMakeFiles/micrortps_agent.dir/build.make:359: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.h’
CMakeFiles/micrortps_agent.dir/build.make:188: warning: ignoring old recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/TimesyncPubSubTypes.h’
CMakeFiles/micrortps_agent.dir/build.make:353: warning: overriding recipe for target ‘/home/andrea/Marea/mar_frankenrotor_ros/ros2SITL/vision_prova/src/px4_ros_com/src/micrortps_agent/Timesync.cpp’

Any suggestions?

Update: managed to solve this by adding

list(REMOVE_DUPLICATES MICRORTPS_AGENT_FILES)

around line 202 in px4_ros_com/cmake/GenerateMicroRTPSAgent.cmake

of course it is an approximate solution, given that the problems seems to be the presence of duplicates in the generated list in the cmake file. I suggest the developers to give a look at it.

@delbesca Have you opened a PR about this?

sorry for my poor knowledge; what does PR means?