Home › Forum › SOFA › Building SOFA › [SOLVED] Build problem for AdvancedFEM plugin
Tagged: 64_bits, GCC, Linux_ubuntu, Plugin_other, SOFA_2006
- This topic has 17 replies, 3 voices, and was last updated 3 years, 9 months ago by amazier.
-
AuthorPosts
-
1 December 2020 at 09:48 #17817amazierBlocked
Hi all,
I am currently trying to update an old plugin to use advanced FEM models. After spending some time generating the Cmake list (thanks to Hugo!), I encountered some errors on the build. I am compiling with GCC 9.
/home/arnaud/dev/sofa/v20.06/src/applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/NonFoldingTetrahedralConstraint.cpp:58: error: explicit instantiation of 'NonFoldingTetrahedralConstraint' does not refer to a function template, variable template, member function, member class, or static data member
The code is the following where the object is normally added to the factory and I do not understand what is done wrongly.
SOFA_DECL_CLASS(NonFoldingTetrahedralConstraint) int NonFoldingTetrahedralConstraintClass = core::RegisterObject("Remove Folding Tetrahedra") #ifndef SOFA_FLOAT .add< NonFoldingTetrahedralConstraint<Vec3dTypes> >() #endif #ifndef SOFA_DOUBLE .add< NonFoldingTetrahedralConstraint<Vec3fTypes> >() #endif ; #ifndef SOFA_FLOAT template class SOFA_ADVANCED_FEM_API NonFoldingTetrahedralConstraint<Vec3dTypes>; #endif #ifndef SOFA_DOUBLE template class SOFA_ADVANCED_FEM_API NonFoldingTetrahedralConstraint<Vec3fTypes>; #endif
If I comment the template function, I obtain an error on the library that I do not understand…
FAILED: lib/libSofaAdvancedFEM.so.0.1 : && /usr/bin/g++ -fPIC -Wall -W -Wno-padded -shared -Wl,-soname,libSofaAdvancedFEM.so.0.1 -o lib/libSofaAdvancedFEM.so.0.1 applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/initAdvancedFEM.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/NonFoldingTetrahedralConstraint.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/AdhesiveSurfaceForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/TetrahedralBiquadraticSpringsForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/TetrahedralQuadraticSpringsForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/FastHexahedralCorotationalForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/TetrahedralTotalLagrangianForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/TetrahedralStVenantKirchhoffForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/NeoHookeanForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/MRForceField.cpp.o applications/plugins/SofaAdvancedFEM/SofaAdvancedFEM/CMakeFiles/SofaAdvancedFEM.dir/TriangleMomentForceField.cpp.o -Wl,-rpath,/home/arnaud/dev/sofa/v20.06/build3/lib: -lSofaComponentBase lib/libSofaUserInteraction.so.20.06.99 lib/libSofaMiscForceField.so.20.06.99 lib/libSofaMiscFem.so.20.06.99 lib/libSofaGeneralMeshCollision.so.20.06.99 lib/libSofaMeshCollision.so.20.06.99 lib/libSofaObjectInteraction.so.20.06.99 lib/libSofaRigid.so.20.06.99 lib/libSofaBaseCollision.so.20.06.99 lib/libSofaGeneralRigid.so.20.06.99 lib/libSofaBaseMechanics.so.20.06.99 lib/libSofaGeneralVisual.so.20.06.99 lib/libSofaTopologyMapping.so.20.06.99 lib/libSofaGraphComponent.so.20.06.99 lib/libSofaSimulationTree.so.20.06.99 lib/libSofaBaseUtils.so.20.06.99 lib/libSofaBaseVisual.so.20.06.99 lib/libSofaDeformable.so.20.06.99 lib/libSofaBoundaryCondition.so.20.06.99 lib/libSofaEigen2Solver.so.20.06.99 lib/libSofaBaseLinearSolver.so.20.06.99 lib/libSofaMiscTopology.so.20.06.99 /usr/lib/x86_64-linux-gnu/libz.so lib/libSofaGeneralTopology.so.20.06.99 lib/libSofaSimpleFem.so.20.06.99 lib/libSofaBaseTopology.so.20.06.99 lib/libSofaSimulationCommon.so.20.06.99 lib/libSofaSimulationCore.so.20.06.99 lib/libSofaCore.so.20.06.99 lib/libSofaDefaultType.so.20.06.99 lib/libSofaHelper.so.20.06.99 /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLEW.so /usr/lib/x86_64-linux-gnu/libboost_system.so /usr/lib/x86_64-linux-gnu/libboost_filesystem.so /usr/lib/x86_64-linux-gnu/libboost_program_options.so /usr/lib/x86_64-linux-gnu/libboost_thread.so /usr/lib/x86_64-linux-gnu/libboost_chrono.so /usr/lib/x86_64-linux-gnu/libboost_date_time.so /usr/lib/x86_64-linux-gnu/libboost_atomic.so lib/libgtest.so.2.6.2 -pthread lib/libnewmat.a -Wl,-rpath-link,/home/arnaud/dev/sofa/v20.06/build3/lib && : /usr/bin/ld: cannot find -lSofaComponentBase collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
Thanks for your help and have a nice day,
1 December 2020 at 10:25 #17818FroyKeymasterFor your first error, please give some more information from your class NonFoldingTetrahedralConstraint
But π§:
– there is no more compilation (by default) of Vec3fTypes (no more #ifndef SOFA_DOUBLE …)
– SofaComponentBase has been renamed one or two releases ago (?), now this package is called SofaBase. So you will need to link against SofaBase (instead of SofaComponentBase)1 December 2020 at 15:10 #17821amazierBlockedHi Froy,
Thank you for your super quick answer!
The first error is not urgent for the moment but I will ping you if I cannot solve the issue.
As for the second one, indeed, replacing SofaComponentBase by SofaBase in the Cmake fixed the issue of the build πOnce the build is done, I am running runSofa and obtain the following error:
[ERROR] [PluginManager] Plugin loading failed (/home/arnaud/dev/sofa/v20.06/build3/lib/libSofaAdvancedFEM.so): /home/arnaud/dev/sofa/v20.06/build3/lib/libSofaAdvancedFEM.so: undefined symbol: _ZNK4sofa9component8topology30NumericalIntegrationDescriptorIfLi3EE19getQuadratureMethodENS3_16QuadratureMethodEm [ERROR] [PluginManager] Plugin not found: "Modeler" Warning: Setting a new default format with a different version or profile after the global shared context is created may cause issues with context sharing. The constructor with a QGLFormat is deprecated, use the regular contructor instead.
So for Modeler, I suppose maybe it is not supported anymore or has been replaced. As for the second one, I have no idea why the lib has such undefined symbol.. Do you have any idea?
EDIT: I cleaned the Cmake file and got rid of the Modeler
Merci2 December 2020 at 00:03 #17822FroyKeymasterAccording to the demangler,
You would need the definition ofsofa::component::topology::NumericalIntegrationDescriptor<float, 3>::getQuadratureMethod(sofa::component::topology::NumericalIntegrationDescriptor<float, 3>::QuadratureMethod, unsigned long) const
And this NumericalIntegrationDescriptor is currently only compiled with double (BaseTopology/NumericalIntegrationDescriptor.cpp)
Therefore, you will need to add the templated definition with
#include <SofaBaseTopology/NumericalIntegrationDescriptor.inl>
to be able to instanciate with new templated class with float
2 December 2020 at 09:40 #17825amazierBlockedThank you for your answer Froy!
Now it is done but I am bumping into another obstacle when I am running SOFA:terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid ########## SIG 6 - SIGABRT: usually caused by an abort() or assert() ########## -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::BackTrace::dump()+0x27) [0x7f417169c2b7] -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::BackTrace::sig(int)+0x1d6) [0x7f417169c656] -> /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f4171168210] -> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb) [0x7f417116818b] -> /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b) [0x7f4171147859] -> /lib/x86_64-linux-gnu/libstdc++.so.6(+0x9e951) [0x7f41713cd951] -> /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa47c) [0x7f41713d947c] -> /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa4e7) [0x7f41713d94e7] -> /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa799) [0x7f41713d9799] -> /lib/x86_64-linux-gnu/libstdc++.so.6(std::__throw_logic_error(char const*)+0x41) [0x7f41713d025e] -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::checkDuplicatedPlugin(sofa::helper::system::Plugin const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0xad4) [0x7f4171757894] -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::loadPluginByPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)+0x10eb) [0x7f417175ab2b] -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::loadPluginByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, std::ostream*)+0x70) [0x7f417175c170] -> /home/arnaud/dev/sofa/v20.06/build2/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::readFromIniFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x646) [0x7f417175d826] -> ./runSofa(+0x157a6) [0x55cf77f917a6] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f41711490b3] -> ./runSofa(+0x168ce) [0x55cf77f928ce] Aborted (core dumped
A problem with the plugin name?
2 December 2020 at 09:50 #17826FroyKeymasterFirst time I see this error π
According to the code, PluginManager calls the function
getModuleName()
from your plugin (without checking if it is defined by the dll π).So I suppose there is a problem with this function in your plugin (not defined ? nullptr?)
2 December 2020 at 14:45 #17827amazierBlockedHi Froy,
Indeed, I did not include the
getModuleName()
in the init.cpp!
Now I can properly load the plugin and use it, many thanks!I still have a little interrogation.
When I am running SOFA I obtain the following message:[INFO] [PluginManager] Loaded plugin: /home/arnaud/dev/sofa/v20.06/build3/lib/libSofaAdvancedFEM.so [INFO] [PluginManager] Plugin not found in loaded plugins: SofaAdvancedFEM
Which states that SOFA loaded the plugin but did not find it. But I can actually use without any problem the object of my plugin… Do you have any idea why?
Thank you again,
4 December 2020 at 23:52 #17947HugoKeymasterStrange. Indeed it seems well loaded.. the second [INFO] is weird.
Any idea @froy? is that related to the recent work on isLoaded?Hugo
5 December 2020 at 13:46 #17950FroyKeymasterNo idea; can you tell us the version of SOFA ? (master, release, etc)
7 December 2020 at 10:31 #17960amazierBlockedHi Froy and Hugo,
Sorry I was not connected this weekend.
For my SOFA version, I am on the master branch but did not pull for a while.
I am trying a pull and will let you know.Best,
7 December 2020 at 13:39 #17966amazierBlockedLittle update:
By pulling, many DEPRECATED arise and I have some issue for compiling just SOFA (on STL mesh if I remember) so I think it is maybe not suitable to be up to date.
Here is the last commit that I have on master:commit 97060f71c42287699823c7d3548d06c8c4ef8af7 (HEAD -> master) Merge: 2bf81d557a 1be78658a5 Author: Guillaume Paran <guillaume.paran@sofa-framework.org> Date: Mon Nov 2 14:43:12 2020 +0100 Merge pull request #1563 from fredroy/modularize_general_animloop [SofaGeneral] Pluginize SofaGeneralAnimationLoop
Best,
8 December 2020 at 11:31 #17975FroyKeymaster2-3 weeks ago, a PR related to this issue has been merged.
https://github.com/sofa-framework/sofa/pull/1615
It may solve this error. π€14 January 2021 at 22:31 #1822918 January 2021 at 16:47 #18244amazierBlockedHi Hugo,
Sorry for not having given any news…
Unfortunately, I tried to merge the PM on my SOFA but it did not work.Best,
Arnaud4 February 2021 at 17:01 #18500HugoKeymasterHey @amazier
Sorry for not being responsive. We will be more available now.
Did you update your SOFA master branch since then?
Do you still have this strange message in PluginManager? I guess it prevents your from using any class from the plugin, is it?Best wishes,
Hugo
5 February 2021 at 17:50 #18543amazierBlockedHi Hugo,
I tried to update my branch 1 month ago but it did not work. Do you want me to try on the new release branch?
I still have this strange message but the thing is that I can still use my plugin’s class. So, in the end, it is not a big problem, it was just to let you know that I had this message despite my working plugin πNo problem, have a nice weekend,
Arnaud17 February 2021 at 21:12 #18712HugoKeymasterIf it is not a blocking point, it is fine for me: this plugin being a private plugin I can not access it and help you debugging it.
I would bet for a CMakeLists.txt issue. If you want to investigate the fix, you can get inspired for other CMakeLists.txt as in Cosserat plugin for instance. If not, I let you close the topic.
Best wishes.
Hugo
18 February 2021 at 10:11 #18717amazierBlockedHi Hugo,
Yes, no problem for me the plugin is working fine. I just found the message a bit strange given that it was working fine π
I am closing the topic, thanks again for your help SOFA consortium!Best,
Arnaud -
AuthorPosts
- You must be logged in to reply to this topic.