tukl-msd / msdlib.loopy

the Loopy hardware-in-the-loop framework
3 stars 4 forks source link

Example GPIO fails to compile #6

Closed steffesm closed 10 years ago

steffesm commented 10 years ago

The host program of the example GPIO fails to compile in eclipse. According to eclipse, the errors are located inside the automatically created API in the file /src/api/gpio.h.

A closer insepction of the file suggests that there are several undefined functions in the libraries mutex and condition _varable.

It seems like the libraries and are missing or don't define the needed variables std::mutex and std:condition_variable and the functions lock() and wait(). It seems to me that the file /src/api/gpio.cpp is also missing orits functions are built into board side framework.

cdeschryver commented 10 years ago

Hi, which compiler version are you using? Cheers Chris

mweberUKL commented 10 years ago

Hi,

There are several hints all over the internet that this seams to be a bug in the Eclipse CDT. Here are some references to StackOverflow questions with hints:

I have tried some of the solutions, yet without success yet. But on the other hand, maybe someone with more experience with C++ than I have should try that ;-).

Cheers, Mathias

steffesm commented 10 years ago

i am using the development environment on the server the installed versions are eclipse kepler release 2 and gcc and g++ 4.8.2 i think

mweberUKL commented 10 years ago

To solve the problem that std::mutex, std::condition_variable and all the other C++11 symbols are not found do the following:

Go to Project -> Properties -> C/C++ General -> Path and Symbols -> Tab [Symbols] and add the symbol __cplusplus with value 201103L under GNU C++ language.

There are some compile errors left that I can fix at some point in the generator. One involves casting between values of the severity enum and int and one is a missing #include "gpio.h" in the file api/components.h.

steffesm commented 10 years ago

The casting errror can be fixed by changing the 2nd argument of the logger declarations in api/logger.cpp to an element of severity declared in logger.h like this for example:

logger logger_board(NULL, FINEST, "Board: ");

It is also unclear to me which int value corresponds to which severity value.

To solve the issue permently it needs to be fixed in the code generator with the correct conversion, until then these two changes need to be done manually after generation.

steffesm commented 10 years ago

It seems this example is working as intended (it is doing what is described in the c++ file).

steffesm commented 10 years ago

Update: It seems the bug in logger.h is caused by a missing log level definition in the file ´´´system.bdf´´´. I suggest that we could either make these definitions i.e. the lines log host info "host.log" log board info "board.log" (where info is any value of the type severity) mandatory or just default to a log level that only logs things we want every user to see.

mweberUKL commented 10 years ago

I have fixed the problem in the generator. I'm currently performing tests to check that all examples work fine. The default logging level is ERROR (as was before, since the int-values are assigned based on the order of the declared values of the severity enum). One I successfully generated all the examples I will issue a pull request.

cdeschryver commented 10 years ago

Fixed