helloworld-2 RPATH issue: cannot find -lrtt-marshalling-gnulinux

Hi all
I'm using the orocos toolchain 2.3. In the hello-2-properties example (orocos_toolchain_ros/rtt_exercises/rtt-exercises/hello-2-properties) is written:

* (note: To make this permanent for your component,
* in C++ you need to #include <rtt/marsh/Marshalling.hp

* and add to the constructor: this->getProvider<Marshalling>("marshalling");
* and in the Makefile: link with rtt-marshalling-<target> found in lib/orocos/plugins
* and also add the lib/orocos/plugins directory to the RPATH.
* endnote)

I added the headerfile (compile OK), then I added in the CMakeLists.txt "rtt-marshalling-${OROCOS_TARGET}" to the target_link_libraries, such that

target_link_libraries( HelloWorld orocos-taskbrowser-${OROCOS_TARGET} rtt-marshalling-${OROCOS_TARGET})

When I try to compile it says:
[...]
[100%] Building CXX object CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o
Linking CXX executable ../HelloWorld-gnulinux
/usr/bin/ld: cannot find -lrtt-marshalling-gnulinux
collect2: ld returned 1 exit status
[...]

RPATH: so I thought it is the missing RPATH setting. I added
set (CMAKE_SKIP_BUILD_RPATH FALSE)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set (CMAKE_INSTALL_RPATH "/home/eberlid/orocos_toolchain_ros/rtt/install/lib/orocos/plugins")
set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

to the CMakeLists.txt (the library lrtt-marshalling-gnulinux.so exists at this location!). Same result (cannot find lrtt-marshalling-gnulinux). I also called make clean after changing CMakeLists.txt.

How can I make it find the library?

Thanks
Dani

Permanent Marshalling service

Hi all, I'm trying to complete this exercise too with version 2.3.1 of the rtt-exercises. I added all the expected line either in hello-2-properties/HelloWorld.cpp and hello-2-properties/CMakeLists.txt. If I comment the line 'this->getProvider<Marshalling>("marshalling");' the building process works but it does not when I set the service:


        • Build of configuration Linux GCC for project hello-2-properties ****

make all Makefile:7: This Makefile builds this package with default settings Orocos-RTT found in /home/andrew/orocos-toolchain-2.3.1/install/lib/cmake/orocos-rtt/orocos-rtt-gnulinux-libraries.cmake mkdir -p build cd build ; cmake .. -DINSTALL_PATH=orocos && make -- Found orocos-rtt for the gnulinux target. Available transports: corba mqueue -- Configuring done -- Generating done -- Build files have been written to: /home/andrew/rtt-exercises-2.3.1/hello-2-properties/build [UseOrocos] Building package hello-2-properties [UseOrocos] Linking all targets with libraries from package 'ocl'. [UseOrocos] Linking all targets with libraries from package 'ocl-taskbrowser'. make[1]: ingresso nella directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" Building executable HelloWorld [UseOrocos] Generating package version 1.0 (default version). make[2]: ingresso nella directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" make[3]: ingresso nella directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" Scanning dependencies of target HelloWorld make[3]: uscita dalla directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" make[3]: ingresso nella directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" [100%] Building CXX object CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o Linking CXX executable HelloWorld-gnulinux CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o: In function `boost::shared_ptr<RTT::Marshalling> boost::make_shared<RTT::Marshalling, RTT::TaskContext*>(RTT::TaskContext* const&)': make[3]: uscita dalla directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" HelloWorld.cpp:(.text._ZN5boost11make_sharedIN3RTT11MarshallingEPNS1_11TaskContextEEENS_10shared_ptrIT_EERKT0_[boost::shared_ptr<RTT::Marshalling> boost::make_shared<RTT::Marshalling, RTT::TaskContext*>(RTT::TaskContext* const&)]+0xd7): undefined reference to `RTT::Marshalling::Marshalling(RTT::TaskContext*)' make[2]: uscita dalla directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o: In function `boost::shared_ptr<RTT::Marshalling>::shared_ptr<RTT::ServiceRequester>(boost::shared_ptr<RTT::ServiceRequester> const&, boost::detail::dynamic_cast_tag)': HelloWorld.cpp:(.text._ZN5boost10shared_ptrIN3RTT11MarshallingEEC1INS1_16ServiceRequesterEEERKNS0_IT_EENS_6detail16dynamic_cast_tagE[boost::shared_ptr<RTT::Marshalling>::shared_ptr<RTT::ServiceRequester>(boost::shared_ptr<RTT::ServiceRequester> const&, boost::detail::dynamic_cast_tag)]+0x29): undefined reference to `typeinfo for RTT::Marshalling' collect2: ld returned 1 exit status make[3]: *** [HelloWorld-gnulinux] Errore 1 make[1]: uscita dalla directory "/home/andrew/rtt-exercises-2.3.1/hello-2-properties/build" make[2]: *** [CMakeFiles/HelloWorld.dir/all] Errore 2 make[1]: *** [all] Errore 2 make: *** [all] Errore 2


Thanks.

Andrea

helloworld-2 RPATH issue: cannot find -lrtt-marshalling-gnulinux

On Friday 01 April 2011 15:59:52 Eberli Dani wrote:
> Hi all
> I'm using the orocos toolchain 2.3. In the hello-2-properties example
> (orocos_toolchain_ros/rtt_exercises/rtt-exercises/hello-2-properties) is
> written:
>
> * (note: To make this permanent for your component,
> * in C++ you need to #include <rtt/marsh/Marshalling.hp

> * and add to the constructor:
> this->getProvider<Marshalling>("marshalling"); * and in the Makefile:
> link with rtt-marshalling-<target> found in lib/orocos/plugins * and
> also add the lib/orocos/plugins directory to the RPATH. * endnote)
>
> I added the headerfile (compile OK), then I added in the CMakeLists.txt
> "rtt-marshalling-${OROCOS_TARGET}" to the target_link_libraries, such that
>
> target_link_libraries( HelloWorld orocos-taskbrowser-${OROCOS_TARGET}
> rtt-marshalling-${OROCOS_TARGET})
>
> When I try to compile it says:
> [...]
> [100%] Building CXX object CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o
> Linking CXX executable ../HelloWorld-gnulinux
> /usr/bin/ld: cannot find -lrtt-marshalling-gnulinux
> collect2: ld returned 1 exit status
> [...]
>
> RPATH: so I thought it is the missing RPATH setting. I added
> set (CMAKE_SKIP_BUILD_RPATH FALSE)
> set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
> set (CMAKE_INSTALL_RPATH
> "/home/eberlid/orocos_toolchain_ros/rtt/install/lib/orocos/plugins") set
> (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
>
> to the CMakeLists.txt (the library lrtt-marshalling-gnulinux.so exists at
> this location!). Same result (cannot find lrtt-marshalling-gnulinux). I
> also called make clean after changing CMakeLists.txt.
>
> How can I make it find the library?

This patch shows what to do:

diff --git a/rtt-exercises/hello-2-properties/CMakeLists.txt b/rtt-
exercises/hello-2-properties/CMakeLists.txt
index 668c070..a6c6bed 100644
--- a/rtt-exercises/hello-2-properties/CMakeLists.txt
+++ b/rtt-exercises/hello-2-properties/CMakeLists.txt
@@ -30,7 +30,7 @@ endif()
 
 # Set the CMAKE_PREFIX_PATH in case you're not using Orocos through ROS
 # for helping these find commands find RTT.
-find_package(Orocos-RTT REQUIRED ${RTT_HINTS})
+find_package(Orocos-RTT REQUIRED rtt-marshalling ${RTT_HINTS})
 
 # Defines the orocos_* cmake macros. See that file for additional
 # documentation.
@@ -39,6 +39,7 @@ include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake)
 # Creates an orocos executable HelloWorld
 orocos_use_package(ocl-taskbrowser)
 orocos_executable(HelloWorld HelloWorld.cpp) # ...you may add multiple source 
files
+target_link_libraries( HelloWorld ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} )
 
 #
 # Makes this an installable/usable package for other packages.
diff --git a/rtt-exercises/hello-2-properties/HelloWorld.cpp b/rtt-
exercises/hello-2-properties/HelloWorld.cpp
index 0a60d82..c0ef287 100644
--- a/rtt-exercises/hello-2-properties/HelloWorld.cpp
+++ b/rtt-exercises/hello-2-properties/HelloWorld.cpp
@@ -19,6 +19,7 @@
 
 #include <ocl/OCL.hpp>
 #include <ocl/TaskBrowser.hpp>
+#include <rtt/marsh/Marshalling.hpp>
 
 using namespace std;
 using namespace RTT;
@@ -100,6 +101,8 @@ namespace Example
 
             this->addAttribute("the_attribute", attribute);
             this->addConstant("the_constant", constant);
+
+            this->getProvider<Marshalling>("marshalling");
         }
     };
 }

I've put the documentation of the find_package(Orocos-RTT) command online here:
http://www.orocos.org/wiki/orocos/toolchain/getting-started/cmake-and-bu...

I'll update the documentation of that example to refer to that page.

Peter

helloworld-2 RPATH issue: cannot find -lrtt-marshalling-gnulinux

In addition I had to write

# Creates an orocos executable HelloWorld
orocos_executable(HelloWorld HelloWorld.cpp) # ...you may add multiple source files
target_link_libraries( HelloWorld orocos-taskbrowser-${OROCOS_TARGET} ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} )

instead of

# Creates an orocos executable HelloWorld
orocos_use_package(ocl-taskbrowser)
orocos_executable(HelloWorld HelloWorld.cpp) # ...you may add multiple source files
target_link_libraries( HelloWorld ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} )

It works now!
Thanks!

helloworld-2 RPATH issue: cannot find -lrtt-marshalling-gnulinux

On Friday 01 April 2011 19:42:28 Eberli Dani wrote:
> In addition I had to write
>
> # Creates an orocos executable HelloWorld
> orocos_executable(HelloWorld HelloWorld.cpp) # ...you may add multiple
> source files target_link_libraries( HelloWorld
> orocos-taskbrowser-${OROCOS_TARGET} ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY}
> )

This can't be correct :-) It's orocos-ocl-taskbrowser-${OROCOS_TARGET}. So
this means you're using RTT 2.2.x instead of 2.3.x ? orocos_use_package() is a
2.3.0 macro as well.

You can check the library version used by doing 'ldd HelloWorld-gnulinux'

>
> instead of
>
> # Creates an orocos executable HelloWorld
> orocos_use_package(ocl-taskbrowser)
> orocos_executable(HelloWorld HelloWorld.cpp) # ...you may add multiple
> source files target_link_libraries( HelloWorld
> ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} )
>
> It works now!
> Thanks!

Peter

helloworld-2 RPATH issue: cannot find -lrtt-marshalling-gnulinux

I think I'm running RTT 2.2.x :-)
I try to figure out how this all works together... I'll continue with the next exercises :-)

Thanks a lot!
Dani

eberlid@eberlid-desktop:~/orocos_toolchain_ros/rtt_exercises/rtt-exercises/hello-2-properties$ ldd HelloWorld-gnulinux
linux-vdso.so.1 => (0x00007fff2dfff000)
liborocos-rtt-gnulinux.so.2.2 => /home/eberlid/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.so.2.2 (0x00007f586be9f000)
liborocos-taskbrowser-gnulinux.so.2.2.0 => /home/eberlid/orocos_toolchain_ros/ocl/lib/liborocos-taskbrowser-gnulinux.so.2.2.0 (0x00007f586bc69000)
librtt-marshalling-gnulinux.so.2.2.1 => /home/eberlid/orocos_toolchain_ros/rtt/install/lib/orocos/plugins/librtt-marshalling-gnulinux.so.2.2.1 (0x00007f586b9b8000)
libboost_filesystem.so.1.40.0 => /usr/lib/libboost_filesystem.so.1.40.0 (0x00007f586b77f000)
libboost_system.so.1.40.0 => /usr/lib/libboost_system.so.1.40.0 (0x00007f586b57a000)
libboost_serialization.so.1.40.0 => /usr/lib/libboost_serialization.so.1.40.0 (0x00007f586b309000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f586b0ec000)
librt.so.1 => /lib/librt.so.1 (0x00007f586aee3000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f586acdf000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f586a9cb000)
libm.so.6 => /lib/libm.so.6 (0x00007f586a747000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f586a530000)
libc.so.6 => /lib/libc.so.6 (0x00007f586a1ad000)
libreadline.so.6 => /lib/libreadline.so.6 (0x00007f5869f6b000)
libncurses.so.5 => /lib/libncurses.so.5 (0x00007f5869d28000)
librtt-scripting-gnulinux.so.2.2.1 => /home/eberlid/orocos_toolchain_ros/rtt/install/lib/orocos/plugins/librtt-scripting-gnulinux.so.2.2.1 (0x00007f58696d2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f586c25e000)