Si-elegans / physics_simulation

C. elegans muscle simulation
Apache License 2.0
0 stars 1 forks source link

CMake errors and make errors #1

Open thejohnhoffer opened 4 years ago

thejohnhoffer commented 4 years ago

I've tried to build this physics simulation using the instructions to create your own plugin using the source code of sofa. I have tried to build against both the latest version of sofa (v20.06) and a version of sofa (v17.12) from when this plugin was released two years ago. I'm running CMake 3.18.2 on MacOS High Sierra (10.13.6).

My development process is to copy the src directory of this project to a folder named src/applications/plugins/SiElegans within my local copy of the sofa framework.

CMake errors

First, I run into several issues running "Configure" from the CMake App. Among the first is here:

CMake Error at applications/plugins/SiElegans/CMakeLists.txt:57 (SOFA_QT4_WRAP_CPP):
  Unknown CMake command "SOFA_QT4_WRAP_CPP".

I apparently 'fix' this by replacing SOFA_QT4_WRAP_CPP with a call to QT4_WRAP_CPP

Then I run into another error here:

CMake Error at applications/plugins/SiElegans/CMakeLists.txt:62 (ToRelativePath):
  Unknown CMake command "ToRelativePath".

I simply comment out line 62 from CMakeLists. I'm sure this is not a real solution.

After I replace "AddCompilerDefinitions" with "add_compile_definitions" on line 68, I run into two more errors with CMake, on line 69 and line 70:

CMake Error at applications/plugins/SiElegans/CMakeLists.txt:69 (AddSourceDependencies):
  Unknown CMake command "AddSourceDependencies".

and

CMake Error at applications/plugins/SiElegans/CMakeLists.txt:70 (AddLinkerDependencies):
  Unknown CMake command "AddLinkerDependencies".

I don't know much about CMake, so once again I comment out these two lines to allow CMake's "Configure" and "Generate" to run without errors.

make errors

So, I switch to the terminal and run make from the build directory.

I run into this error with SaveScreenshots.h file not being found here:

/Users/john/projects/sofa/src/applications/plugins/SiElegans/SiElegansAnimationLoop.h:11:10: fatal error: 'SaveScreenShots.h' file not found
#include "SaveScreenShots.h"

Naively, I believe it's fine if we simply compile without saving screenshots, so I comment out that include statement.

On the very next line however, I get an error about InterfaceManagerActivation.h not being found.

/Users/john/projects/sofa/src/applications/plugins/SiElegans/SiElegansAnimationLoop.h:12:10: fatal error: 'InterfaceManagerActivation.h' file not found
#include "InterfaceManagerActivation.h"

This seems a bit more important than screenshots. However, I can't find any source online that references the name "InterfaceManagerActivation". It seems like it was a bit of source code that was once a part of this repository and perhaps just never made it to Github. It doesn't seem to be a part of the sofa API.

If I just comment out that include statement, I get another import error that I can easily fix by changing #include <sofa/simulation/common/DefaultAnimationLoop.h> to #include <sofa/simulation/DefaultAnimationLoop.h>:

/Users/john/projects/sofa/src/applications/plugins/SiElegans/SiElegansAnimationLoop.h:14:10: fatal error: 'sofa/simulation/common/DefaultAnimationLoop.h' file not found       
#include <sofa/simulation/common/DefaultAnimationLoop.h>

Finally, I see two errors I believe to be related to the missing SaveScreenShots.h and InterfaceManagerActivation.h:

/Users/john/projects/sofa/src/applications/plugins/SiElegans/SiElegansAnimationLoop.h:61:19: error: no member named 'misc' in namespace 'sofa::component'
        sofa::component::misc::SaveScreenShots* m_screensaver;
        ~~~~~~~~~~~~~~~~~^
/Users/john/projects/sofa/src/applications/plugins/SiElegans/SiElegansAnimationLoop.h:62:19: error: no member named 'mass' in namespace 'sofa::component'
        sofa::component::mass::InterfaceManagerActivation<defaulttype::Vec3dTypes,double>* m_muscleActivation;

I believe the two header files that are missing must have added some functionality to the sofa::component namespace. I am not very experienced in C++, and I am sure my ignorance shows to anyone reading this. I apologize for writing such a lengthy bug report here, and I'm very grateful for anyone's feedback.

thejohnhoffer commented 4 years ago

I realize sofa::component::misc and sofa::component::mass are part of the sofa API. But I figure that sofa::component::misc::SaveScreenShots should have been defined by SaveScreenShots.h and sofa::component::mass::InterfaceManagerActivation should have been defined by InterfaceManagerActivation.h.

Kiwiwiki commented 1 year ago

Have you finally complied this plugin and used it ?