rtiddsgen bug: 0 no viable alternative

6 posts / 0 new
Last post
Offline
Last seen: 1 year 1 month ago
Joined: 10/09/2022
Posts: 13
rtiddsgen bug: 0 no viable alternative

Hi, I got the following error when use  rtiddsgen to generate types files. 

ERROR com.rti.ndds.nddsgen.antlr.auto.IdlParser tpc_alarm.idl line 11:0 no viable alternative at input '# 11 "tpc_alarm.idl" 3\n' in member declaration
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)

The idl files are listed:

// tpc_common.idl

 

#ifndef __TPC_COMMON_IDL__
#define __TPC_COMMON_IDL__

#define TPC_NAME_LEN 16

struct TPC_Common {
    char name[TPC_NAME_LEN];
    unsigned long long loopCounter;
    unsigned long long timeStamp;
};

#endif

// tpc_alarm.idl

#ifndef __TPC_ALARM_IDL__
#define __TPC_ALARM_IDL__

#include "tpc_common.idl"

struct TPC_AlarmPlayerCmd {
    TPC_Common common;
    boolean on;
    char alerter[TPC_NAME_LEN];
    unsigned long long id;
};

#endif

Build command:  rtiddsgen -replace -language C++ -d . tpc_alarm.idl

RTI context DDS: 6.1.1

OS:  Ubuntu 20.04

GCC version: gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 

From the post, I learned this error is caused by GCC-11, however, the gcc version that I used is 9.4.0.

And I also installed gcc version 7.5.0 (Ubuntu 7.5.0-6ubuntu2) and gcc version 8.4.0 (Ubuntu 8.4.0-3ubuntu2), and builded with the following commands, and got the same error!

rtiddsgen -ppPath /usr/bin/cpp-7 -replace -language C++ -d . tpc_alarm.idl

rtiddsgen -ppPath /usr/bin/cpp-8 -replace -language C++ -d . tpc_alarm.idl

However, rtiddsgen works fine with gcc version 8.3.0 (Debian 8.3.0-6) on Debian buster!

So, how can I solve the problem?

 

Keywords:
Howard's picture
Offline
Last seen: 7 hours 7 min ago
Joined: 11/29/2012
Posts: 605

from the help for rtiddgen:

    -ppPath <path to the preprocessor>: Preprocessor path
        The default value is "cpp" for non-Windows architectures and
        "cl.exe" for Windows architectures.
         If you use -ppPath to provide the full path and filename for
         "cl.exe" or the cpp preprocessor, you must also use -ppOption (described below)
         to set the following preprocessor options:
         If you use a non-default path for "cl.exe", you also need to set:
         -ppOption /nologo -ppOption /C -ppOption /E -ppOption /X
         If you use a non-default path for cpp, you also need to set:
         -ppOption -C
    -ppOption <option>: Preprocessor option

try adding "-ppOption -C" to the command arguments when you are using "-ppPath".

Offline
Last seen: 1 year 1 month ago
Joined: 10/09/2022
Posts: 13

I tried the following commands and got the same error.

rtiddsgen -ppPath /usr/bin/cpp-7 -ppOption "-C" -replace -language C++11 tpc_alarm.idl

INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.1.1.3, please wait ...
ERROR com.rti.ndds.nddsgen.antlr.auto.IdlParser tpc_alarm.idl line 11:0 no viable alternative at input '# 11 "tpc_alarm.idl" 3\n' in member declaration
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)

rtiddsgen -ppPath /usr/bin/cpp-8 -ppOption "-C" -replace -language C++11 tpc_alarm.idl
INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 3.1.1.3, please wait ...
ERROR com.rti.ndds.nddsgen.antlr.auto.IdlParser tpc_alarm.idl line 11:0 no viable alternative at input '# 11 "tpc_alarm.idl" 3\n' in member declaration
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)

 

Howard's picture
Offline
Last seen: 7 hours 7 min ago
Joined: 11/29/2012
Posts: 605

Sorry, if that doesn't work, then your best path is to work with RTI's support group which you can contact through your RTI Account team or local RTI distributor.

Offline
Last seen: 1 year 1 month ago
Joined: 10/09/2022
Posts: 13

After several tries,  if envCPLUS_INCLUDE_PATH includes current path (such asCPLUS_INCLUDE_PATH=<some path>:) , it will cause the problem. 

Howard's picture
Offline
Last seen: 7 hours 7 min ago
Joined: 11/29/2012
Posts: 605

Thanks for letting us know that you got it working.