rticommunity / ros-data-types

This repository contains a rich set of ROS data types in OMG IDL format. These types enable you to create native DDS applications capable of interoperating with ROS 2 applications using equivalent message types.
Apache License 2.0
44 stars 23 forks source link

Repo cannot compile for modern versions of GCC due to pre-processing #7

Open baymaxrobotics opened 4 months ago

baymaxrobotics commented 4 months ago

Hi, I have tried building this repo for a more modern version of ROS2 (humble) with gcc 11.2.0.

When building, (both using colcon and directly using make as described in the README file) I keep getting the error:

INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.0.1, please wait ...
line 1:2 mismatched character '0' expecting set null
ERROR com.rti.ndds.nddsgen.antlr.auto.IdlParser line 1:4 no viable alternative at input '"/tmp/rtiddsgen20_8411474834315403847.cc"'
ERROR com.rti.ndds.nddsgen.Main Fail:  java.lang.Exception: The file couldn't be parsed and the rawTree wasn't generated
INFO com.rti.ndds.nddsgen.Main Done (failures)
make[2]: *** [builtin_interfaces/CMakeFiles/builtininterfaceslibrary.dir/build.make:89: builtin_interfaces/msg/Time.cxx] Error 255
make[1]: *** [CMakeFiles/Makefile2:144: builtin_interfaces/CMakeFiles/builtininterfaceslibrary.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I saw the post in https://community.rti.com/forum-topic/after-upgrade-fedora-linux-34-rtiddsgen-no-longer-works so I tried to change the compiler to use GCC 7.5.0, and adding the following lines to the main CMakeLists.txt file:

set(CMAKE_C_COMPILER "gcc-7")
set(CMAKE_CXX_COMPILER "/usr/bin/g++-7"

Unfortunately, the same occurred.

Disabling the pre-processing is not an option because a lot of idl files inherits from idl files within the repo.

For the sake of trying, I only tried to build idl files that don't import from others and in the file ConnextDdsRosDdsTypes.cmake I passed the argument DISABLE_PREPROCESSOR ON to macro connextdds_rtiddsgen_run().

So yes, it does compile, but even there I get warnings:

[ 12%] Generating msg/UInt8.cxx, msg/UInt8Plugin.cxx, msg/UInt8.hpp, msg/UInt8Plugin.hpp
INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.0.1, please wait ...
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer UInt8.idl line 18  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer UInt8.idl line 19  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer UInt8.idl line 32  preprocessor directive not supported. It will be ignored
INFO com.rti.ndds.nddsgen.Main Done
[ 13%] Generating msg/Bool.cxx, msg/BoolPlugin.cxx, msg/Bool.hpp, msg/BoolPlugin.hpp
INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.0.1, please wait ...
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Bool.idl line 18  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Bool.idl line 19  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Bool.idl line 32  preprocessor directive not supported. It will be ignored
INFO com.rti.ndds.nddsgen.Main Done
[ 15%] Generating msg/Byte.cxx, msg/BytePlugin.cxx, msg/Byte.hpp, msg/BytePlugin.hpp
INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.0.1, please wait ...
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Byte.idl line 18  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Byte.idl line 19  preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Byte.idl line 32  preprocessor directive not supported. It will be ignored
INFO com.rti.ndds.nddsgen.Main Done

Any plan to upgrade this repo or is it considered deprecated?

angelrti commented 3 months ago

Hi baymaxrobotics, we plan to upload this repository automatically with the latest version of the ROS types and Connext, although I don't have a deadline yet