Home › Forum › SOFA › Programming with SOFA › [SOLVED] Runtime error in component
Tagged: 64_bits, Linux_ubuntu, SOFA_other, Topology Engine
- This topic has 16 replies, 3 voices, and was last updated 7 years, 7 months ago by Hugo.
-
AuthorPosts
-
1 April 2017 at 12:21 #8853BineshBlocked
Hello guys
i write a component & i need to handle topology . so i want to use “TopologyEngineImpl”.
i wanna to handle topology points
i create a “PointData” variable and use initData in constructor
and also include topologySubData.h ,
after build and run a get “undefined symbol” in application outputs and plugin cannot be load.
How can i fix my problem ?Thanks,
Behnam Binesh4 April 2017 at 18:41 #8857HugoKeymasterHi Binesh,
I guess this component is stored in one of your plugins, right ?
You should set the right dependency to you plugin: you need to find the package SofaBase in which the lib SofaBaseTopology is located. With this lib, you can use the TopologyEngineImpl.This might be a solution. Let me know if it helps,
Cheers,Hugo
4 April 2017 at 23:26 #8858BineshBlockedThanks Dear Hugo
yes , you right , my component stored in one plugin
now , i used “find_package(SOFA_LIB_COMPONENT_BASE_TOPOLOGY REQUIRED)” in my plugin’s cmake file but the cmake show me a error
//******************************************ERROR TEXT*****************************
error: By not providing “FindLIB_COMPONENT_BASE_TOPOLOGY.cmake” in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by “LIB_COMPONENT_BASE_TOPOLOGY”, but CMake did not find one. Could not find a package configuration file provided by “LIB_COMPONENT_BASE_TOPOLOGY” with any of the following names: LIB_COMPONENT_BASE_TOPOLOGYConfig.cmake lib_component_base_topology-config.cmake Add the installation prefix of “LIB_COMPONENT_BASE_TOPOLOGY” to CMAKE_PREFIX_PATH or set “LIB_COMPONENT_BASE_TOPOLOGY_DIR” to a directory containing one of the above files. If “LIB_COMPONENT_BASE_TOPOLOGY” provides a separate development package or SDK, be sure it has been installed.
//**********************************************************************************7 April 2017 at 11:34 #8890HugoKeymasterHi Binesh,
Sorry for the delay, we’re quite busy right now.
It should be written this way:find_package(SofaBase REQUIRED) ... set(LINKER_DEPENDENCIES ${LINKER_DEPENDENCIES} SofaBaseTopology) ... target_link_libraries(${PROJECT_NAME} ${LINKER_DEPENDENCIES})
Let me know if it helps.
Hugo
11 April 2017 at 09:13 #8898BineshBlockedHi Hugo,
Thanks for reply, i used this code but the error still available , when i write “SofaBase REQUIRED” i got an error like my previous post,
i’m so sorry but give me another solution , THANKS DEAR HUGOBinesh
11 April 2017 at 10:42 #8899epernodBlockedHi @Binesh,
could you post the code of the CMakeList of your plugin, it will be easier to see the problem and reproduce it.
thanks,
Erik
11 April 2017 at 17:18 #8901BineshBlockedHi pernod
yes of courseinclude(${SOFA_CMAKE_DIR}/preProject.cmake) set(HEADER_FILES FreezeSpring.h initFreezeSpring.h FreezeSpring.inl ) set(SOURCE_FILES FreezeSpring.cpp initFreezeSpring.cpp ) set(README_FILES FreezeSpring.txt ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${MOC_FILES} ${SOURCE_FILES} ${README_FILES}) AddCompilerDefinitions("SOFA_BUILD_FREEZESPRING") AddLinkerDependencies(SofaComponentMain) include(${SOFA_CMAKE_DIR}/postProject.cmake)
Thanks @pernod
11 April 2017 at 18:22 #8902HugoKeymasterHi Binesh,
Which version of SOFA are you using btw ?
With the current structure of SOFA, the CMakeList.txt of your plugin FreezeSpring should look pretty close to:cmake_minimum_required(VERSION 3.1) project(FreezeSpring) set(HEADER_FILES FreezeSpring.h initFreezeSpring.h FreezeSpring.inl ) set(SOURCE_FILES FreezeSpring.cpp initFreezeSpring.cpp ) find_package(SofaBase REQUIRED) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_FREEZESPRING") target_link_libraries(${PROJECT_NAME} SofaBaseTopology) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") install(TARGETS ${PROJECT_NAME} COMPONENT FreezeSpring_libraries EXPORT FreezeSpringTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
Agreed Erik?
Hope this helps,Hugo
11 April 2017 at 18:27 #8903BineshBlockedThanks Dear Hugo ,
our SOFA version is old , about 2 years ago and we can not upgrade our sofa to newest version of sofa now , will happen in the future
so i try this cmake and report the resultThanks
Binesh
11 April 2017 at 20:24 #8904BineshBlockedUnfortunately , the problem still remains
🙁12 April 2017 at 09:21 #8906HugoKeymasterOuch, an old version of SOFA will make the debugging pretty complicated :s
Have you try this:
include(${SOFA_CMAKE_DIR}/preProject.cmake) set(HEADER_FILES FreezeSpring.h initFreezeSpring.h FreezeSpring.inl ) set(SOURCE_FILES FreezeSpring.cpp initFreezeSpring.cpp ) set(README_FILES FreezeSpring.txt ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${MOC_FILES} ${SOURCE_FILES} ${README_FILES}) AddCompilerDefinitions("SOFA_BUILD_FREEZESPRING") AddLinkerDependencies(SofaComponentMain) AddLinkerDependencies(SofaBaseTopology) include(${SOFA_CMAKE_DIR}/postProject.cmake)
But the only advice I could give is to update your SOFA version to a stable release (v16.12). I can guess that it might take you some time and effort, but I want you to know that we stay at your disposal to help in this stage of your work.
Let us know about your next move.Hugo
12 April 2017 at 12:08 #8909BineshBlockedThanks Dear Hugo
i try this code but the problem still remains
The error line is :: “undefined symbol: _ZN4sofa9component8topology22TopologySubsetDataImpl
IjNS_6helper6vectorIjNS3_16CPUMemoryManagerIjEEEEE20
linkToPointDataArrayEv”i type definition for points like this ::
typedef helper::vector<unsigned int> SetIndexArray;
typedef sofa::component::topology::PointSubsetData< SetIndexArray > SubSetSetIndex;and finally i declare a variable from SubSetSetIdnex and init data in constructor.
so after build and run i got undefined symbol error
“** Thanks for support dear hugo , in future i upgrade our sofa **”
12 April 2017 at 12:25 #8910HugoKeymasterYeah, your plugin needs to have a clear dependency to the module in SOFA where the TopologySubsetDataImpl is implemented. Without it, it gives a symbol error as you have.
To solve it, you must look for the cmake project that includes the class TopologySubsetDataImpl, and add it in AddLinkerDependencies() in the CMakeLists of your plugin.
Sorry about these issues. Upgrade looks like a proper solution.
12 April 2017 at 12:43 #8911BineshBlockedYes , TopologySubSetDataImpl implemented in SofaBaseTopology and i use AddLinkerDependencies(SofaBaseTopology) in my cmakeFile , But after build i open cmake GUI project and i see that the SofaBaseTopology Dir NOT FOUND ,
Why ?12 April 2017 at 14:10 #8912HugoKeymasterMaybe try to set the path to the SofaBaseTopology lib.
But as I mentioned, with an old version of SOFA, it’s pretty hard to bring remote support.12 April 2017 at 14:57 #8913BineshBlockedThanks Dear Hugo , My Problem fixed by another approach
first i create TopologySubsetData.cpp file in sofabasetopology and include TopologySubsetData.h & TopologySubsetData.inl and declare our template such as ::
template class sofa::component::topology::TopologySubsetDataImpl< sofa::component::topology::Point, sofa::helper::vector <unsigned int > > ;then i use this template in my plugin and undefined symbol error fixed
Thanks
Binesh
12 April 2017 at 17:31 #8915HugoKeymasterCool Binesh!
Nice to hear! Let us know when you’ll upgrade so that we can help.
CheersHugo
-
AuthorPosts
- You must be logged in to reply to this topic.