Marshalling: linking problem

Hi,

I used successfully marshalling with orocos_toolchain_ros 0.1.8 and cturtle with my code in a ROS-package (without any linking commands in the CMakeLists file). Now I just installed the orocos_toolchain_ros 0.2.1 under unstable and when I try to build the same code but now in a OROCOS-package (since this is 'recommended' now) I get a linking problem:

Linking CXX shared library ../lib/orocos/libMasterControl-gnulinux.so
CMakeFiles/MasterControl.dir/src/Control.cpp.o: In function `shared_ptr<RTT::ServiceRequester>':
/usr/include/boost/smart_ptr/shared_ptr.hpp:259: undefined reference to `typeinfo for RTT::Marshalling'
CMakeFiles/MasterControl.dir/src/Control.cpp.o: In function `boost::shared_ptr<RTT::Marshalling> boost::make_shared<RTT::Marshalling, RTT::TaskContext*>(RTT::TaskContext* const&)':
/usr/include/boost/smart_ptr/make_shared.hpp:185: undefined reference to `RTT::Marshalling::Marshalling(RTT::TaskContext*)'
collect2: ld returned 1 exit status
make[3]: *** [../lib/orocos/libMasterControl-gnulinux.so] Error 1
make[3]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
make[2]: *** [CMakeFiles/MasterControl.dir/all] Error 2
make[2]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
make: *** [all] Error 2

All components, types and plugins related macros in my CMakeLists file are deleted except for 'orocos_component(MasterControl src/Control.cpp) '

An older post on this forum seems to report a similar problem for Orogen. There it is suggested that things have to be added to the CMakeLists file. It is however not clear to me what should be added. Does there have to be some explicit linking now or is there something else going on?

Thanks a lot!

Bert

Ps. part of my .bashrc file is:

source /opt/ros/unstable/setup.sh
source /opt/ros/unstable/setup.bash
source /opt/ros/unstable/stacks/orocos_toolchain_ros/env.sh
#source /opt/ros/unstable/setup.sh . /wg/stor2a/bwillaert/.bashrc
 
export ROS_PACKAGE_PATH=/u/bwillaert/workspace1/Ros_Pkg_Bert:/u/bwillaert/workspace2:\$ROS_PACKAGE_PATH
 
#BFL_TYPEKIT_PATH=`rospack find bfl_typekit`/lib/orocos
#KDL_TYPEKIT_PATH=`rospack find kdl_typekit`/install/lib/orocos
RTT_TYPEKIT_PATH=`rospack find rtt`/install/lib/orocos
OCL_TYPEKIT_PATH=`rospack find ocl`/install/lib/orocos
ROS_PACKAGE_PATH_TOSET=\$BFL_TYPEKIT_PATH:\$KDL_TYPEKIT_PATH:$RTT_TYPEKIT_PATH:\$OCL_TYPEKIT_PATH
 
export RTT_COMPONENT_PATH=\$RTT_COMPONENT_PATH:\$ROS_PACKAGE_PATH_TOSET:/opt/orocos/lib/orocos:/opt/orocos/lib/orocos/plugins 

Marshalling: linking problem

On Fri, Feb 11, 2011 at 8:54 PM, <bert [dot] willaert [..] ...> wrote:
> Hi,
>
> I used successfully marshalling with orocos_toolchain_ros 0.1.8 and cturtle with my code in a ROS-package (without any linking commands in the CMakeLists file). Now I just installed the orocos_toolchain_ros 0.2.1 under unstable and when I try to build the same code but now in a OROCOS-package (since this is 'recommended' now) I get a linking problem:
>

> Linking CXX shared library ../lib/orocos/libMasterControl-gnulinux.so
> CMakeFiles/MasterControl.dir/src/Control.cpp.o: In function `shared_ptr<RTT::ServiceRequester>':
> /usr/include/boost/smart_ptr/shared_ptr.hpp:259: undefined reference to `typeinfo for RTT::Marshalling'
> CMakeFiles/MasterControl.dir/src/Control.cpp.o: In function `boost::shared_ptr<RTT::Marshalling> boost::make_shared<RTT::Marshalling, RTT::TaskContext*>(RTT::TaskContext* const&)':
> /usr/include/boost/smart_ptr/make_shared.hpp:185: undefined reference to `RTT::Marshalling::Marshalling(RTT::TaskContext*)'
> collect2: ld returned 1 exit status
> make[3]: *** [../lib/orocos/libMasterControl-gnulinux.so] Error 1
> make[3]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
> make[2]: *** [CMakeFiles/MasterControl.dir/all] Error 2
> make[2]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/wg/stor2a/bwillaert/workspace1/Ros_Pkg_Bert/Master_controller/build'
> make: *** [all] Error 2
> 

>
> All components, types and plugins related macros in my CMakeLists file are deleted except for 'orocos_component(MasterControl src/Control.cpp) '
>
> An older post on this forum seems to report a similar problem for Orogen. There it is suggested that things have to be added to the CMakeLists file.
> It is however not clear to me what should be added. Does there have to be some explicit linking now or is there something else going on?

Yes, you need to link explicitly. We added a link flag such that each
component must be linked correctly at build-time.

You can do:

find_package(OROCOS-RTT REQUIRED rtt-marshalling ${RTT_HINTS})
and then add after your orocos_component( MasterControl ) :
target_link_libraries( MasterControl ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} )

See this file for all docs :
http://gitorious.org/orocos-toolchain/rtt/blobs/master/orocos-rtt-config...

We're working on it to make this linking automatic, but the above will
always work, also in the future.

Peter