Home › Forum › SOFA › Building SOFA › [SOLVED] Sofa 20.06 is only partly linked
Tagged: 64_bits, GCC, Linux_ubuntu, SOFA_2006
- This topic has 2 replies, 2 voices, and was last updated 3 years, 10 months ago by Peter.
-
AuthorPosts
-
8 January 2021 at 11:11 #18138PeterBlocked
Dear Community,
TLDR;
SofaBaseMechanics and a few other Sofa shared libraries are silently not linked using catkin_make ROS.For my ROS project I needed a to update a side project (using Sofa) to update from v18.06 to v20.06. It seemed I made it compile with small changes to the code.
But at the end the Sofa was only partly linked. I use ROS noetic and catkin_make, which is as far as I understand just a wrapper for cmake + make.>ld devel/lib/libmesh_deformer.so ld: warning: cannot find entry symbol _start; not setting start address ld: devel/lib/libmesh_deformer.so: undefined reference to sofa::component::mass::DiagonalMass<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, float>, sofa::defaulttype::Vec<3, float>, float>, float>::DiagonalMass()' ld: devel/lib/libmesh_deformer.so: undefined reference tosofa::component::topology::PointSetGeometryAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, float>, sofa::defaulttype::Vec<3, float>, float> >::initPointAdded(unsigned int, sofa::core::topology::PointAncestorElem const&, sofa::helper::vector<sofa::helper::vector<sofa::defaulttype::Vec<3, float>, sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3, float> > >*, sofa::helper::CPUMemoryManager<sofa::helper::vector<sofa::defaulttype::Vec<3, float>, sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3, float> > >*> > const&, sofa::helper::vector<sofa::helper::vector<sofa::defaulttype::Vec<3, float>, sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3, float> > >*, sofa::helper::CPUMemoryManager<sofa::helper::vector<sofa::defaulttype::Vec<3, float>, sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3, float> > >*> > const&)' ... ld: devel/lib/libmesh_deformer.so: undefined reference to sofa::component::topology::TriangleSetGeometryAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, float>, sofa::defaulttype::Vec<3, float>, float> >::init()' ld: devel/lib/libmesh_deformer.so: undefined reference to sofa::component::forcefield::SurfacePressureForceField<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, float>, sofa::defaulttype::Vec<3, float>, float> >::setPressure(float)'
I double checked that I give target_linked_libraries all the Sofa-Libraries by: SOFA_LIBRARIES.
I also checked compiling with Release. As I compiled Sofa with Release.
For sanity I gave it none Sofa Libraries and than no Sofa-Libraries are linked at all.
As I found it’s only the following Libraries, which are not linked: libSofaMiscForceField.so.20.06.01, libSofaBaseMechanics.so.20.06.01, libSofaBaseTopology.so.20.06.01target_link_libraries(mesh_deformer ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES} ${SOFA_LIBRARIES} )
Inspecting the libmesh_deformer.so with
readelf --dynamic
I found that the last one is linked in deed? But the other ones not.Dynamic section at offset 0x176b60 contains 56 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libSofaHelper.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaBaseLinearSolver.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaBaseTopology.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaAdvanced.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaBase.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaCommon.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaGeneral.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaMisc.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaCore.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaGuiCommon.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaGuiMain.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaImplicitOdeSolver.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaLoader.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaOpenglVisual.so.1.0] 0x0000000000000001 (NEEDED) Shared library: [libSofaSimulationCommon.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaSimulationTree.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libSofaSimulationCore.so.20.06.01] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libroscpp.so] 0x0000000000000001 (NEEDED) Shared library: [librosconsole.so] 0x0000000000000001 (NEEDED) Shared library: [libroscpp_serialization.so] 0x0000000000000001 (NEEDED) Shared library: [librostime.so] 0x0000000000000001 (NEEDED) Shared library: [libgazebo_rendering.so.11] 0x0000000000000001 (NEEDED) Shared library: [libgazebo_common.so.11] 0x0000000000000001 (NEEDED) Shared library: [libsdformat9.so.9] 0x0000000000000001 (NEEDED) Shared library: [libOgreMain.so.1.9.0] 0x0000000000000001 (NEEDED) Shared library: [libignition-math6.so.6] 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000e (SONAME) Library soname: [libmesh_deformer.so] 0x000000000000001d (RUNPATH) Library runpath: [/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/home/username/workspace/sofa/install_latest_release/lib:/home/username/workspace/sofa/install_latest_release/plugins/SofaExporter/lib:/home/username/workspace/sofa/install_latest_release/plugins/SofaHaptics/lib:/home/username/workspace/sofa/install_latest_release/plugins/SofaOpenglVisual/lib:/home/username/workspace/sofa/install_latest_release/plugins/SofaPreconditioner/lib:/home/username/workspace/sofa/install_latest_release/plugins/SofaSparseSolver/lib:/home/username/workspace/sofa/install_latest_release/plugins/SceneCreator/lib:/opt/ros/noetic/lib:/home/username/workspace/ros_ws_only_mediassist3_sim/devel/lib] ...
I have no clue why catkin_make silently do not link. I expected this to be go off at compile time.
8 January 2021 at 13:09 #18139jnbrunetModeratorHey Peter,
By default, SOFA is compiling using double precision. Hence the following:
sofa::component::mass::DiagonalMass<Vec3fTypes, float>::DiagonalMass()'
Won’t be able to link as it is not defined.
To fix it, you can do one of three solution:
1. In your code, useVec3dTypes
instead ofVec3fTypes
anddouble
instead offloat
. Or better, useVec3Types
to make sure you are using the same floating point type as the one used for the compilation of SOFA
2. Include in your cpp file theDiagonalMass.inl
header file before using the DiagonalMass with a float type:#include <SofaBaseMechanics/DiagonalMass.inl> (...) sofa::component::mass::DiagonalMass<Vec3fTypes,float> some_mass_component;
This will compile the DiagonalMass with float support in your .cpp file.
3. Compile SOFA yourself and set the CMake variableSOFA_FLOATING_POINT_TYPE
tofloat
J-N
8 January 2021 at 18:27 #18162PeterBlockedHello J-N,
This solved my problem.
I just brought my project to double precision. I again learned something.Thanks for the extend answer!
Peter
-
AuthorPosts
- You must be logged in to reply to this topic.