Registered Member
|
Hello,
time ago I posted a problem about a link issue using Eigen in a embedded system: viewtopic.php?f=74&t=98611 The other day I could isolate a little bit more the problem. If I use operations between matrices, or matrix decomposition, everything is ok. But if I use solve method (or inverse for "large" matrices) I can not link the program because I have the error posted in the before topic. However, if I do not link with stdc++ , I have realized that I only have the error when the operator new is called. By the way, depending on 'the complexity' of the operation, the call to 'new' can be avoided just increasing the -Ox compiler option (related with the before link), but if you use solve method, even with -O3, the call to 'new' can not be avoided. This is the error from the linker:
Does it mean that solve() method require always dynamic memory for working? (because it should not be allowed in my system). So, even with fixed matrices, I can still have creation of new aux matrices? I have compiled the code with -DNDEBUG -DEIGEN_NO_MALLOC -DEIGEN_RUNTIME_NO_MALLOC (I do not know if it helps in some way), and I still have the same link error. Herewith is a test code, if I comment the last two lines, everything goes fine.
By the way, looking at the Memory.h
I guess this is not related with the creation of any aux matrix? Can I get around my problem? |
Moderator
|
To be sure you could try to compile with -DEIGEN_EXCEPTIONS?
|
Registered Member
|
Hello ggael, thanks for the response. Unfortunately, I am compiling with -fno-exceptions (I do not allow throws neither). Finally, I have worked the problem out just writing a minimal implementation of the syscalls. Now I can compile Eigen stuff without problems, even with -O0. Probably I will rewrite _kill and _exit just in case the microcontroller goes in for doing easy a possible debug tracking.
I do not have my hardware available in the next two weeks. However, I would like to knoe if Eigen needs in whatever way this syscalls working properly (not just with this minimal implementation). I mean, all my matrices in the system are static, should I be afraid of some dynamic allocation (or calls to the system such as abort etc) using solve, householder, etc? (I am only using Dense stuff). Thanks in advance for the help. |
Moderator
|
hi,
I wanted to suggested you to overload operator new, but your solution is fine too. Today I fixed an issue where solving for a fixed size matrix as the right hand side triggered a dynamic allocation when alloca was not available. Except for memory allocation, Eigen does not rely on any particular behavior of syscalls. Another exception is to handle runtime assertion when EIGEN_NO_DEBUG (or NDEBUG) is not defined. With fixed sizes objects most assertion should be resolved at compile time, but who knows... |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell