Hello,
I have a questions about the deployer. Can a deployed component use a static library ? I haven't found any information about this on the website.
I tried using a static library in a deployed component, but I get a "undefined symbol" error when loading the component. The component works fine when started from ORO_main (not using the deployer ). ORO_CREATE_COMPONENT is added at the bottom of the file and it compiles fine with the following compile flags:
set (OROTARGET "gnulinux") set (OROPATH "/usr/local") set ( CMAKE_CXX_USER_FLAGS "-I${OROPATH}/include -DOROCOS_TARGET=${OROTARGET} -O2 -Wall -fPIC -DOCL_DLL_EXPORT" ) set( USER_LINK_FLAGS "-shared -fPIC -L${OROPATH}/lib -Wl,-rpath ${OROPATH}/lib -lorocos-rtt-${OROTARGET} -lstaticLibrary" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_USER_FLAGS} ${USER_LINK_FLAGS}" )
"staticLibrary" is the static library that contains functions required by the deployed component.
When starting the deployer with an xml file as argument, the deployer tries to load the component and I get an error "undefined symbol", if the code uses something from the static library.
How can I use a static library in a deployed component ?
How to use a static library in a deployed component ?
Hi !
I am not an Orocos specialist, but we had this kind of problems. So I gonna try to help.
I think you can not use a static library in a application deployed with the standard deployer.
Using a static libraries works if you create the component yourself (started from ORO_main, not using the deployer) because your executable (containing the main) is linked with your static library.
When you compile for the deployer (using ORO_CREATE_COMPONENT), it creates a dynamic library, but this library does not contain the code of the static library, and the main (deployer-gnulinux) neither => you have undefined symbols.
I do not know if it is possible to tell the linker that the static library should be incorporated into the dynamic library, and that would not be a good idea as if you have many components using the static library, then you would have duplicated symbols.
To solve that problem, the solution I would suggest is to re-compile the deployer (see ocl/bin/deployer.cpp) and link it with your static library.
This is really a bad fix, but it should work.
In our application we use a specific deployer, with a specific main. All the static library we need are linked with the main.
Re: How to use a static library in a deployed component ?
Hi !
I am not an Orocos specialist, but we had this kind of problems. So I gonna try to help.
I think you can not use a static library in a application deployed with the standard deployer.
Using a static libraries works if you create the component yourself (started from ORO_main, not using the deployer) because your executable (containing the main) is linked with your static library.
When you compile for the deployer (using ORO_CREATE_COMPONENT), it creates a dynamic library, but this library does not contain the code of the static library, and the main (deployer-gnulinux) neither => you have undefined symbols. I do not know if it is possible to tell the linker that the static library should be incorporated into the dynamic library, and that would not be a good idea as if you have many components using the static library, then you would have duplicated symbols.
To solve that problem, the solution I would suggest is to re-compile the deployer (see ocl/bin/deployer.cpp) and link it with your static library.
This is really a bad fix, but it should work.
In our application we use a specific deployer, with a specific main. All the static library we need are linked with the main.