GElliott / pgm

A real-time-oriented implementation of the Processing Graph Method (PGM).
2 stars 3 forks source link

Lots of error in make showing struct rt_task’ has no member named ‘XXX‘ #1

Open songzeceng opened 4 years ago

songzeceng commented 4 years ago

I tried to compile pgm with litmusRT(linux-4.9-litmus),but I got lots of errors as following:

tools/pgmrt.cpp: In function ‘void work_thread(rt_config)’:
tools/pgmrt.cpp:420:8: error: ‘struct rt_task’ has no member named ‘split’
  param.split = cfg.split_factor;
        ^~~~~
tools/pgmrt.cpp:427:9: error: ‘struct rt_task’ has no member named ‘pgm_type’
   param.pgm_type = PGM_SRC_SINK;
         ^~~~~~~~
tools/pgmrt.cpp:427:20: error: ‘PGM_SRC_SINK’ was not declared in this scope
   param.pgm_type = PGM_SRC_SINK;
                    ^~~~~~~~~~~~
tools/pgmrt.cpp:427:20: note: suggested alternative: ‘PGM_SYNC_SCOPE’
   param.pgm_type = PGM_SRC_SINK;
                    ^~~~~~~~~~~~
                    PGM_SYNC_SCOPE
tools/pgmrt.cpp:429:9: error: ‘struct rt_task’ has no member named ‘pgm_type’
   param.pgm_type = PGM_SRC;
         ^~~~~~~~
tools/pgmrt.cpp:429:20: error: ‘PGM_SRC’ was not declared in this scope
   param.pgm_type = PGM_SRC;
                    ^~~~~~~
tools/pgmrt.cpp:431:9: error: ‘struct rt_task’ has no member named ‘pgm_type’
   param.pgm_type = PGM_SINK;
         ^~~~~~~~
tools/pgmrt.cpp:431:20: error: ‘PGM_SINK’ was not declared in this scope
   param.pgm_type = PGM_SINK;
                    ^~~~~~~~
tools/pgmrt.cpp:431:20: note: suggested alternative: ‘EMLINK’
   param.pgm_type = PGM_SINK;
                    ^~~~~~~~
                    EMLINK
tools/pgmrt.cpp:433:9: error: ‘struct rt_task’ has no member named ‘pgm_type’
   param.pgm_type = PGM_INTERNAL;
         ^~~~~~~~
tools/pgmrt.cpp:433:20: error: ‘PGM_INTERNAL’ was not declared in this scope
   param.pgm_type = PGM_INTERNAL;
                    ^~~~~~~~~~~~
tools/pgmrt.cpp:433:20: note: suggested alternative: ‘_IO_INTERNAL’
   param.pgm_type = PGM_INTERNAL;
                    ^~~~~~~~~~~~
                    _IO_INTERNAL
tools/pgmrt.cpp:435:8: error: ‘struct rt_task’ has no member named ‘pgm_expected_etoe’
  param.pgm_expected_etoe = cfg.expected_etoe;
        ^~~~~~~~~~~~~~~~~
tools/pgmrt.cpp:74:2: error: ‘enter_pgm_wait’ was not declared in this scope
  enter_pgm_wait(); \
  ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^~~~~~~~~~~~~~~
tools/pgmrt.cpp:74:2: note: suggested alternative: ‘litmus_pgm_wait’
  enter_pgm_wait(); \
  ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^~~~~~~~~~~~~~~
tools/pgmrt.cpp:76:2: error: ‘exit_pgm_wait’ was not declared in this scope
  exit_pgm_wait();
  ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^~~~~~~~~~~~~~~
tools/pgmrt.cpp:76:2: note: suggested alternative: ‘pgm_wait’
  exit_pgm_wait();
  ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^~~~~~~~~~~~~~~
tools/pgmrt.cpp:80:2: error: ‘enter_pgm_send’ was not declared in this scope
  enter_pgm_send(); \
  ^
tools/pgmrt.cpp:505:5: note: in expansion of macro ‘litmus_pgm_complete’
     litmus_pgm_complete(CheckError(pgm_complete(cfg.node)););
     ^~~~~~~~~~~~~~~~~~~
tools/pgmrt.cpp:80:2: note: suggested alternative: ‘enter_np’
  enter_pgm_send(); \
  ^
tools/pgmrt.cpp:505:5: note: in expansion of macro ‘litmus_pgm_complete’
     litmus_pgm_complete(CheckError(pgm_complete(cfg.node)););
     ^~~~~~~~~~~~~~~~~~~
tools/pgmrt.cpp:82:2: error: ‘exit_pgm_send’ was not declared in this scope
  exit_pgm_send();
  ^
tools/pgmrt.cpp:505:5: note: in expansion of macro ‘litmus_pgm_complete’
     litmus_pgm_complete(CheckError(pgm_complete(cfg.node)););
     ^~~~~~~~~~~~~~~~~~~
tools/pgmrt.cpp: In function ‘void parse_graph_rates(const string&, graph_t, std::map<pgm_node_handle, double, node_compare>&)’:
tools/pgmrt.cpp:785:19: error: ‘us2ms’ was not declared in this scope
   periods_ms[n] = us2ms((double)(iter->second.y)/iter->second.x);
                   ^~~~~
tools/pgmrt.cpp:785:19: note: suggested alternative: ‘ns2ms’
   periods_ms[n] = us2ms((double)(iter->second.y)/iter->second.x);
                   ^~~~~
                   ns2ms

I cannot find member named split in the source code of litmusRT of branch linux-4.9-litmus or master-before-2013.1or master-before-2014.2...

Besides nothrow in the code below is of no use with build error, so I comment it out.

 // pgm.cpp line 1637
 gGraphs = new (nothrow) struct pgm_graph[PGM_MAX_GRAPHS];
GElliott commented 4 years ago

struct rt_task is defined by Litmus in include/litmus/rt_param.h. I can't recall what the split field was for. I can't find it it in any of the versions of Litmus that I have. What happens if you simply comment it out?

songzeceng commented 4 years ago

Thanks for help.I comment out every nonexist rt_task field used in tools/pgmrt.cpp,but I still got some new errors as below showing undefined fields in some macro definition

tools/pgmrt.cpp:74:17: error: ‘enter_pgm_wait’ was not declared in this scope
  enter_pgm_wait(); \
                 ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^
tools/pgmrt.cpp:76:16: error: ‘exit_pgm_wait’ was not declared in this scope
  exit_pgm_wait();
                ^
tools/pgmrt.cpp:480:4: note: in expansion of macro ‘litmus_pgm_wait’
    litmus_pgm_wait(ret = pgm_wait(cfg.node););
    ^
tools/pgmrt.cpp:80:17: error: ‘enter_pgm_send’ was not declared in this scope
  enter_pgm_send(); \
                 ^
tools/pgmrt.cpp:505:5: note: in expansion of macro ‘litmus_pgm_complete’
     litmus_pgm_complete(CheckError(pgm_complete(cfg.node)););
     ^
tools/pgmrt.cpp:82:16: error: ‘exit_pgm_send’ was not declared in this scope
  exit_pgm_send();

I see the related codes in tools/pgmrt as following and macros like litmus_pgm_wait are used somwhere else in this file. So I don`t know how to handle it

#ifdef _USE_LITMUS
// waiting task's priority is boosted as needed
#define litmus_pgm_wait(statements) \
    enter_pgm_wait(); \
    statements \
    exit_pgm_wait();
// signalling task's priority is unconditionally boosted,
// so just enter a non-preemptive section.
#define litmus_pgm_complete(statements) \
    enter_pgm_send(); \
    statements \
    exit_pgm_send();
songzeceng commented 4 years ago

I solved it by comment all the codes related to such macros. They are

// litmus_pgm_complete(CheckError(pgm_complete(cfg.node)););

and

// litmus_pgm_wait(ret = pgm_wait(cfg.node););

with macro definition

/*#define litmus_pgm_wait(statements) \
    enter_pgm_wait(); \
    statements \
    exit_pgm_wait();*/
// signalling task's priority is unconditionally boosted,
// so just enter a non-preemptive section.
/*#define litmus_pgm_complete(statements) \
    enter_pgm_send(); \
    statements \
    exit_pgm_send();*/

I am worried the impact on the functionality but at least I get my compliation passed. Maybe you should update the source code of pgm