undefined reference to `RTT::(anonymous namespace)::ComponentFactories::Factories'

Hi all,

I am trying to build a component library (composed of several components).
The compilation failed with a stanged error that I don't understand :
-> undefined reference to `RTT::(anonymous
namespace)::ComponentFactories::Factories'

After reading the result of the verbose make command, the compiler command
seems strange when linking components :
-> /usr/bin/c++ [..] -larp-core-gnulinux
/home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.so.2.2.1
-lSUSI-3.02 [...]

By the way, there is 2 Component.hpp files : one in rtt, and one in ocl.
Which is the rigth one ? If one is no more used, could the API be depracated
?

Extract of make VERBOSE=2 result :

Linking CXX shared library ../../lib/libarp-hml-gnulinux.so
cd /media/DD_data/home/ard/ros/ard/arp_hml/build/src && /usr/bin/cmake -E
cmake_link_script CMakeFiles/arp-hml.dir/link.txt --verbose=2
/usr/bin/c++ -fPIC -DRTT_COMPONENT -Os -DNDEBUG -Wl,-z,defs -shared
-Wl,-soname,libarp-hml-gnulinux.so -o ../../lib/libarp-hml-gnulinux.so
CMakeFiles/arp-hml.dir/HML.cpp.o CMakeFiles/arp-hml.dir/PCM3362.cpp.o
CMakeFiles/arp-hml.dir/can/dictionnary/CanARD.c.o
CMakeFiles/arp-hml.dir/can/CanOpen.cpp.o
CMakeFiles/arp-hml.dir/joystick/Joystick.cpp.o
CMakeFiles/arp-hml.dir/joystick/GamepadPS1.cpp.o
CMakeFiles/arp-hml.dir/joystick/DefaultJoystick.cpp.o
-L/media/DD_data/home/ard/ros/ard/arp_core/lib
-L/home/ard/ros/orocos_toolchain_ros/ocl/lib
-L/home/ard/ros/orocos_toolchain_ros/log4cpp/install/lib
-L/home/ard/ros/orocos_toolchain_ros/rtt/install/lib* -larp-core-gnulinux
/home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.so.2.2.1
-lSUSI-3.02* -lcanfestival_unix -lcanfestival -lboost_filesystem-mt
-lboost_system-mt -lboost_serialization-mt -lpthread -lrt -ldl
-Wl,-rpath,/media/DD_data/home/ard/ros/ard/arp_core/lib:/home/ard/ros/orocos_toolchain_ros/ocl/lib:/home/ard/ros/orocos_toolchain_ros/log4cpp/install/lib:/home/ard/ros/orocos_toolchain_ros/rtt/install/lib::::::::::::::::::::::::::::::::::::::::::::::::::::::::

CMakeFiles/arp-hml.dir/PCM3362.cpp.o: In function `global constructors keyed
to PCM3362.cpp':
PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
namespace)::ComponentFactories::Factories'
/usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation R_386_GOTOFF
against undefined symbol `RTT::(anonymous
namespace)::ComponentFactories::Factories' can not be used when making a
shared object
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

Here is the export part of my manifest :

<export>
<cpp cflags="-I${prefix}/src" lflags="-Wl,-rpath,${prefix}/lib
-L${prefix}/lib -larp-core-gnulinux" />
<rosbuild cmake_directory="${prefix}/cmake" />
<export>

Here is the Cmake code :

file(
GLOB_RECURSE
source_files
*.c*
)
orocos_component(arp-hml ${source_files})
target_link_libraries(arp-hml SUSI-3.02)
#target_link_libraries(arp-hml arp-hml-can-dico)
target_link_libraries(arp-hml canfestival_unix)
target_link_libraries(arp-hml canfestival)

undefined reference to `RTT::(anonymous namespace)::ComponentFac

On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
> Hi all,
>
> I am trying to build a component library (composed of several components).
> The compilation failed with a stanged error that I don't understand :
> -> undefined reference to `RTT::(anonymous
> namespace)::ComponentFactories::Factories'
>
> After reading the result of the verbose make command, the compiler command
> seems strange when linking components :
> -> /usr/bin/c++ [..] -larp-core-gnulinux
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
> o.2.2.1 -lSUSI-3.02 [...]
>
> By the way, there is 2 Component.hpp files : one in rtt, and one in ocl.
> Which is the rigth one ? If one is no more used, could the API be
> depracated ?

Both are valid and identical, you only need to include one, we recommend
including the RTT one for new components though (see:
http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt...

The error you get is explained by the fact that you didn't write
ORO_CREATE_COMPONENT_TYPE()
in your library sources. In 2.3, this macro is renamed to
ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).

See also: http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deplo...
"Section 3: Setting up a deployable component library"

>
>
> Extract of make VERBOSE=2 result :
>
> Linking CXX shared library ../../lib/libarp-hml-gnulinux.so
> cd /media/DD_data/home/ard/ros/ard/arp_hml/build/src && /usr/bin/cmake -E
> cmake_link_script CMakeFiles/arp-hml.dir/link.txt --verbose=2
> /usr/bin/c++ -fPIC -DRTT_COMPONENT -Os -DNDEBUG -Wl,-z,defs -shared
> -Wl,-soname,libarp-hml-gnulinux.so -o ../../lib/libarp-hml-gnulinux.so
> CMakeFiles/arp-hml.dir/HML.cpp.o CMakeFiles/arp-hml.dir/PCM3362.cpp.o
> CMakeFiles/arp-hml.dir/can/dictionnary/CanARD.c.o
> CMakeFiles/arp-hml.dir/can/CanOpen.cpp.o
> CMakeFiles/arp-hml.dir/joystick/Joystick.cpp.o
> CMakeFiles/arp-hml.dir/joystick/GamepadPS1.cpp.o
> CMakeFiles/arp-hml.dir/joystick/DefaultJoystick.cpp.o
> -L/media/DD_data/home/ard/ros/ard/arp_core/lib
> -L/home/ard/ros/orocos_toolchain_ros/ocl/lib
> -L/home/ard/ros/orocos_toolchain_ros/log4cpp/install/lib
> -L/home/ard/ros/orocos_toolchain_ros/rtt/install/lib* -larp-core-gnulinux
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
> o.2.2.1 -lSUSI-3.02* -lcanfestival_unix -lcanfestival -lboost_filesystem-mt
> -lboost_system-mt -lboost_serialization-mt -lpthread -lrt -ldl
> -Wl,-rpath,/media/DD_data/home/ard/ros/ard/arp_core/lib:/home/ard/ros/oroco
> s_toolchain_ros/ocl/lib:/home/ard/ros/orocos_toolchain_ros/log4cpp/install/
> lib:/home/ard/ros/orocos_toolchain_ros/rtt/install/lib:::::::::::::::::::::
> :::::::::::::::::::::::::::::::::::
>
> CMakeFiles/arp-hml.dir/PCM3362.cpp.o: In function `global constructors
> keyed to PCM3362.cpp':
> PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
> namespace)::ComponentFactories::Factories'
> /usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation R_386_GOTOFF
> against undefined symbol `RTT::(anonymous
> namespace)::ComponentFactories::Factories' can not be used when making a
> shared object
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
>
>
> Here is the export part of my manifest :
>
> <export>
> <cpp cflags="-I${prefix}/src" lflags="-Wl,-rpath,${prefix}/lib
> -L${prefix}/lib -larp-core-gnulinux"/>
> <rosbuild cmake_directory="${prefix}/cmake" />
> <export>
>
>
> Here is the Cmake code :
>
> file(
> GLOB_RECURSE
> source_files
> *.c*
> )
> orocos_component(arp-hml ${source_files})
> target_link_libraries(arp-hml SUSI-3.02)
> #target_link_libraries(arp-hml arp-hml-can-dico)
> target_link_libraries(arp-hml canfestival_unix)
> target_link_libraries(arp-hml canfestival)

Peter

undefined reference to `RTT::(anonymous namespace)::ComponentFac

2011/3/1 Peter Soetens <peter [..] ...>

> On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
> > Hi all,
> >
> > I am trying to build a component library (composed of several
> components).
> > The compilation failed with a stanged error that I don't understand :
> > -> undefined reference to `RTT::(anonymous
> > namespace)::ComponentFactories::Factories'
> >
> > After reading the result of the verbose make command, the compiler
> command
> > seems strange when linking components :
> > -> /usr/bin/c++ [..] -larp-core-gnulinux
> >
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
> > o.2.2.1 -lSUSI-3.02 [...]
> >
> > By the way, there is 2 Component.hpp files : one in rtt, and one in ocl.
> > Which is the rigth one ? If one is no more used, could the API be
> > depracated ?
>
> Both are valid and identical, you only need to include one, we recommend
> including the RTT one for new components though (see:
>
> http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt...
>
> The error you get is explained by the fact that you didn't write
> ORO_CREATE_COMPONENT_TYPE()
> in your library sources. In 2.3, this macro is renamed to
> ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).
>
> See also:
> http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deplo...
> "Section 3: Setting up a deployable component library"
>
>
I was used to separate my code in the following way (with ocl/Component.hpp)
:
_ on component per ComponentXXX.cpp in which I have a
ORO_LIST_COMPONENT_TYPE(XXX)
_ one Lib.cpp in which there is only ORO_CREATE_COMPONENT_TYPE

I tried something : orocreate xx something, copy the xx-component.*pp in
xx-component2.*pp, changed the name of the component class to Xx2 and the
defines at the top of the header. I modifiied the Cmakelist to compile the
two sources in the component library, and edit the cpp to have

ORO_CREATE_COMPONENT_LIBRARY()
// *For the ComponentX type*:
ORO_LIST_COMPONENT_TYPE( Xx)

in one and :

ORO_LIST_COMPONENT_TYPE( Xx2)

The compilation went well.
BUT, if I change the #include "ocl/Component.hpp" in #include
"rtt/Component.hpp" , make clean and rebuild, it failed with the same error
as I had in my project !! This is easy to reproduce. Do you want me to
create a bug ticket ?

orocreate-pkg is really usefull for debugging, I can create a new project a
compare in a simple way if it works in a minimal configuration so I can
avoid spamming with dummy errors :)

You should modify the orocreate tool to include the rtt/Component by default
as it is the official.

BTW , when you orocreat-pkg a package named "test" (which is tempting ^^) It
doesn't works properly because test must be a predifined target. Maybe you
should refuse this package name when parsing the options. I send the patch I
used even if they are dummy modification it's more to play with git than to
be usefull (it tooks me age to produce it ^^)
ard@ard-host-v5:/media/DD_data/home/ard/ros/ard/test$ make
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find
rosbuild`/rostoolchain.cmake ..
[rosbuild] Building package test
including user's config file:
/media/DD_data/home/ard/ros/ros/rosconfig.cmake
[rosbuild] Including
/media/DD_data/home/ard/ros/ros_comm/clients/rospy/cmake/rospy.cmake
[rosbuild] Including
/media/DD_data/home/ard/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake
[rosbuild] Including
/media/DD_data/home/ard/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
Orocos-RTT found in
/home/ard/ros/orocos_toolchain_ros/rtt/install/lib/cmake/orocos-rtt/orocos-rtt-gnulinux-libraries.cmake
-- Found orocos-rtt 2.2.1 for the gnulinux target. Available transports:
mqueue
Building component test in library test-gnulinux
-- Configuring done
WARNING: Target "test" has EXCLUDE_FROM_ALL set and will not be built by
default but an install rule has been provided for it. CMake does not define
behavior for this case.
-- Generating done
-- Build files have been written to:
/media/DD_data/home/ard/ros/ard/test/build
cd build && make
make[1]: entrant dans le répertoire «
/media/DD_data/home/ard/ros/ard/test/build »
make[1]: quittant le répertoire « /media/DD_data/home/ard/ros/ard/test/build
»

undefined reference to `RTT::(anonymous namespace)::ComponentFac

2011/3/1 Willy Lambert <lambert [dot] willy [..] ...>

>
>
> 2011/3/1 Peter Soetens <peter [..] ...>
>
>> On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
>>
>> > Hi all,
>> >
>> > I am trying to build a component library (composed of several
>> components).
>> > The compilation failed with a stanged error that I don't understand :
>> > -> undefined reference to `RTT::(anonymous
>> > namespace)::ComponentFactories::Factories'
>> >
>> > After reading the result of the verbose make command, the compiler
>> command
>> > seems strange when linking components :
>> > -> /usr/bin/c++ [..] -larp-core-gnulinux
>> >
>> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
>> > o.2.2.1 -lSUSI-3.02 [...]
>> >
>> > By the way, there is 2 Component.hpp files : one in rtt, and one in ocl.
>> > Which is the rigth one ? If one is no more used, could the API be
>> > depracated ?
>>
>> Both are valid and identical, you only need to include one, we recommend
>> including the RTT one for new components though (see:
>>
>> http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt...
>>
>> The error you get is explained by the fact that you didn't write
>> ORO_CREATE_COMPONENT_TYPE()
>> in your library sources. In 2.3, this macro is renamed to
>> ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).
>>
>> See also:
>> http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deplo...
>> "Section 3: Setting up a deployable component library"
>>
>>
> I was used to separate my code in the following way (with
> ocl/Component.hpp) :
> _ on component per ComponentXXX.cpp in which I have a
> ORO_LIST_COMPONENT_TYPE(XXX)
> _ one Lib.cpp in which there is only ORO_CREATE_COMPONENT_TYPE
>
> I tried something : orocreate xx something, copy the xx-component.*pp in
> xx-component2.*pp, changed the name of the component class to Xx2 and the
> defines at the top of the header. I modifiied the Cmakelist to compile the
> two sources in the component library, and edit the cpp to have
>
> ORO_CREATE_COMPONENT_LIBRARY()
> // *For the ComponentX type*:
> ORO_LIST_COMPONENT_TYPE( Xx)
>
> in one and :
>
> ORO_LIST_COMPONENT_TYPE( Xx2)
>
> The compilation went well.
> BUT, if I change the #include "ocl/Component.hpp" in #include
> "rtt/Component.hpp" , make clean and rebuild, it failed with the same error
> as I had in my project !! This is easy to reproduce. Do you want me to
> create a bug ticket ?
>
> orocreate-pkg is really usefull for debugging, I can create a new project a
> compare in a simple way if it works in a minimal configuration so I can
> avoid spamming with dummy errors :)
>
> You should modify the orocreate tool to include the rtt/Component by
> default as it is the official.
>
>
I do not have the same problem with the 2.3, linking with rtt/Component.hpp
is OK in a multiple component library

>
>
> BTW , when you orocreat-pkg a package named "test" (which is tempting ^^)
> It doesn't works properly because test must be a predifined target. Maybe
> you should refuse this package name when parsing the options. I send the
> patch I used even if they are dummy modification it's more to play with git
> than to be usefull (it tooks me age to produce it ^^)
> ard@ard-host-v5:/media/DD_data/home/ard/ros/ard/test$ make
> mkdir -p bin
> cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find
> rosbuild`/rostoolchain.cmake ..
> [rosbuild] Building package test
> including user's config file:
> /media/DD_data/home/ard/ros/ros/rosconfig.cmake
> [rosbuild] Including
> /media/DD_data/home/ard/ros/ros_comm/clients/rospy/cmake/rospy.cmake
> [rosbuild] Including
> /media/DD_data/home/ard/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake
> [rosbuild] Including
> /media/DD_data/home/ard/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
> Orocos-RTT found in
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/cmake/orocos-rtt/orocos-rtt-gnulinux-libraries.cmake
> -- Found orocos-rtt 2.2.1 for the gnulinux target. Available transports:
> mqueue
> Building component test in library test-gnulinux
> -- Configuring done
> WARNING: Target "test" has EXCLUDE_FROM_ALL set and will not be built by
> default but an install rule has been provided for it. CMake does not define
> behavior for this case.
> -- Generating done
> -- Build files have been written to:
> /media/DD_data/home/ard/ros/ard/test/build
> cd build && make
> make[1]: entrant dans le répertoire «
> /media/DD_data/home/ard/ros/ard/test/build »
> make[1]: quittant le répertoire «
> /media/DD_data/home/ard/ros/ard/test/build »
>
>
>

undefined reference to `RTT::(anonymous namespace)::ComponentFac

2011/3/3 Willy Lambert <lambert [dot] willy [..] ...>

>
>
> 2011/3/1 Willy Lambert <lambert [dot] willy [..] ...>
>
>
>>
>> 2011/3/1 Peter Soetens <peter [..] ...>
>>
>>> On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
>>>
>>> > Hi all,
>>> >
>>> > I am trying to build a component library (composed of several
>>> components).
>>> > The compilation failed with a stanged error that I don't understand :
>>> > -> undefined reference to `RTT::(anonymous
>>> > namespace)::ComponentFactories::Factories'
>>> >
>>> > After reading the result of the verbose make command, the compiler
>>> command
>>> > seems strange when linking components :
>>> > -> /usr/bin/c++ [..] -larp-core-gnulinux
>>> >
>>> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
>>> > o.2.2.1 -lSUSI-3.02 [...]
>>> >
>>> > By the way, there is 2 Component.hpp files : one in rtt, and one in
>>> ocl.
>>> > Which is the rigth one ? If one is no more used, could the API be
>>> > depracated ?
>>>
>>> Both are valid and identical, you only need to include one, we recommend
>>> including the RTT one for new components though (see:
>>>
>>> http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt...
>>>
>>> The error you get is explained by the fact that you didn't write
>>> ORO_CREATE_COMPONENT_TYPE()
>>> in your library sources. In 2.3, this macro is renamed to
>>> ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).
>>>
>>> See also:
>>> http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deplo...
>>> "Section 3: Setting up a deployable component library"
>>>
>>>
>> I was used to separate my code in the following way (with
>> ocl/Component.hpp) :
>> _ on component per ComponentXXX.cpp in which I have a
>> ORO_LIST_COMPONENT_TYPE(XXX)
>> _ one Lib.cpp in which there is only ORO_CREATE_COMPONENT_TYPE
>>
>> I tried something : orocreate xx something, copy the xx-component.*pp in
>> xx-component2.*pp, changed the name of the component class to Xx2 and the
>> defines at the top of the header. I modifiied the Cmakelist to compile the
>> two sources in the component library, and edit the cpp to have
>>
>> ORO_CREATE_COMPONENT_LIBRARY()
>> // *For the ComponentX type*:
>> ORO_LIST_COMPONENT_TYPE( Xx)
>>
>> in one and :
>>
>> ORO_LIST_COMPONENT_TYPE( Xx2)
>>
>> The compilation went well.
>> BUT, if I change the #include "ocl/Component.hpp" in #include
>> "rtt/Component.hpp" , make clean and rebuild, it failed with the same error
>> as I had in my project !! This is easy to reproduce. Do you want me to
>> create a bug ticket ?
>>
>> orocreate-pkg is really usefull for debugging, I can create a new project
>> a compare in a simple way if it works in a minimal configuration so I can
>> avoid spamming with dummy errors :)
>>
>> You should modify the orocreate tool to include the rtt/Component by
>> default as it is the official.
>>
>>
> I do not have the same problem with the 2.3, linking with rtt/Component.hpp
> is OK in a multiple component library
>
>
Arf, lured again, it happens, sorry for the mis-information, time to go to
bed :)

>
>
>>
>>
>> BTW , when you orocreat-pkg a package named "test" (which is tempting ^^)
>> It doesn't works properly because test must be a predifined target. Maybe
>> you should refuse this package name when parsing the options. I send the
>> patch I used even if they are dummy modification it's more to play with git
>> than to be usefull (it tooks me age to produce it ^^)
>> ard@ard-host-v5:/media/DD_data/home/ard/ros/ard/test$ make
>> mkdir -p bin
>> cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find
>> rosbuild`/rostoolchain.cmake ..
>> [rosbuild] Building package test
>> including user's config file:
>> /media/DD_data/home/ard/ros/ros/rosconfig.cmake
>> [rosbuild] Including
>> /media/DD_data/home/ard/ros/ros_comm/clients/rospy/cmake/rospy.cmake
>> [rosbuild] Including
>> /media/DD_data/home/ard/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake
>> [rosbuild] Including
>> /media/DD_data/home/ard/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
>> Orocos-RTT found in
>> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/cmake/orocos-rtt/orocos-rtt-gnulinux-libraries.cmake
>> -- Found orocos-rtt 2.2.1 for the gnulinux target. Available transports:
>> mqueue
>> Building component test in library test-gnulinux
>> -- Configuring done
>> WARNING: Target "test" has EXCLUDE_FROM_ALL set and will not be built by
>> default but an install rule has been provided for it. CMake does not define
>> behavior for this case.
>> -- Generating done
>> -- Build files have been written to:
>> /media/DD_data/home/ard/ros/ard/test/build
>> cd build && make
>> make[1]: entrant dans le répertoire «
>> /media/DD_data/home/ard/ros/ard/test/build »
>> make[1]: quittant le répertoire «
>> /media/DD_data/home/ard/ros/ard/test/build »
>>
>>
>>
>

undefined reference to `RTT::(anonymous namespace)::ComponentFac

2011/3/1 Peter Soetens <peter [..] ...>

> On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
> > Hi all,
> >
> > I am trying to build a component library (composed of several
> components).
> > The compilation failed with a stanged error that I don't understand :
> > -> undefined reference to `RTT::(anonymous
> > namespace)::ComponentFactories::Factories'
> >
> > After reading the result of the verbose make command, the compiler
> command
> > seems strange when linking components :
> > -> /usr/bin/c++ [..] -larp-core-gnulinux
> >
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
> > o.2.2.1 -lSUSI-3.02 [...]
> >
> > By the way, there is 2 Component.hpp files : one in rtt, and one in ocl.
> > Which is the rigth one ? If one is no more used, could the API be
> > depracated ?
>
> Both are valid and identical, you only need to include one, we recommend
> including the RTT one for new components though (see:
>
> http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt...
>
>
thanks

> The error you get is explained by the fact that you didn't write
> ORO_CREATE_COMPONENT_TYPE()
> in your library sources. In 2.3, this macro is renamed to
> ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).
>
> See also:
> http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deplo...
> "Section 3: Setting up a deployable component library"
>
>
hum... I am surprised as it is a port of the code I used to compile in the
standalone orocos toolchain and I am now trying to "copy paste" it in my
project done in the orocos_toolchain_ros. I must have forgot something
somewhere, I'll have a look.

I don't know if it is technically possible to change this error output text,
but it is not direct to switch from

PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
namespace)::ComponentFactories::Factories'
/usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation R_386_GOTOFF
against undefined symbol `RTT::(anonymous
namespace)::ComponentFactories::Factories' can not be used when making a
shared object

to "Oh god I forgot once again the macros" :p

> >
> >
> > Extract of make VERBOSE=2 result :
> >
> > Linking CXX shared library ../../lib/libarp-hml-gnulinux.so
> > cd /media/DD_data/home/ard/ros/ard/arp_hml/build/src && /usr/bin/cmake -E
> > cmake_link_script CMakeFiles/arp-hml.dir/link.txt --verbose=2
> > /usr/bin/c++ -fPIC -DRTT_COMPONENT -Os -DNDEBUG -Wl,-z,defs -shared
> > -Wl,-soname,libarp-hml-gnulinux.so -o ../../lib/libarp-hml-gnulinux.so
> > CMakeFiles/arp-hml.dir/HML.cpp.o CMakeFiles/arp-hml.dir/PCM3362.cpp.o
> > CMakeFiles/arp-hml.dir/can/dictionnary/CanARD.c.o
> > CMakeFiles/arp-hml.dir/can/CanOpen.cpp.o
> > CMakeFiles/arp-hml.dir/joystick/Joystick.cpp.o
> > CMakeFiles/arp-hml.dir/joystick/GamepadPS1.cpp.o
> > CMakeFiles/arp-hml.dir/joystick/DefaultJoystick.cpp.o
> > -L/media/DD_data/home/ard/ros/ard/arp_core/lib
> > -L/home/ard/ros/orocos_toolchain_ros/ocl/lib
> > -L/home/ard/ros/orocos_toolchain_ros/log4cpp/install/lib
> > -L/home/ard/ros/orocos_toolchain_ros/rtt/install/lib* -larp-core-gnulinux
> >
> /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux.s
> > o.2.2.1 -lSUSI-3.02* -lcanfestival_unix -lcanfestival
> -lboost_filesystem-mt
> > -lboost_system-mt -lboost_serialization-mt -lpthread -lrt -ldl
> >
> -Wl,-rpath,/media/DD_data/home/ard/ros/ard/arp_core/lib:/home/ard/ros/oroco
> >
> s_toolchain_ros/ocl/lib:/home/ard/ros/orocos_toolchain_ros/log4cpp/install/
> >
> lib:/home/ard/ros/orocos_toolchain_ros/rtt/install/lib:::::::::::::::::::::
> > :::::::::::::::::::::::::::::::::::
> >
> > CMakeFiles/arp-hml.dir/PCM3362.cpp.o: In function `global constructors
> > keyed to PCM3362.cpp':
> > PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
> > namespace)::ComponentFactories::Factories'
> > /usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation
> R_386_GOTOFF
> > against undefined symbol `RTT::(anonymous
> > namespace)::ComponentFactories::Factories' can not be used when making a
> > shared object
> > /usr/bin/ld: final link failed: Bad value
> > collect2: ld returned 1 exit status
> >
> >
> > Here is the export part of my manifest :
> >
> > <export>
> > <cpp cflags="-I${prefix}/src" lflags="-Wl,-rpath,${prefix}/lib
> > -L${prefix}/lib -larp-core-gnulinux"/>
> > <rosbuild cmake_directory="${prefix}/cmake" />
> > <export>
> >
> >
> > Here is the Cmake code :
> >
> > file(
> > GLOB_RECURSE
> > source_files
> > *.c*
> > )
> > orocos_component(arp-hml ${source_files})
> > target_link_libraries(arp-hml SUSI-3.02)
> > #target_link_libraries(arp-hml arp-hml-can-dico)
> > target_link_libraries(arp-hml canfestival_unix)
> > target_link_libraries(arp-hml canfestival)
>
> Peter
>

undefined reference to `RTT::(anonymous namespace)::ComponentFac

On Tuesday 01 March 2011 14:33:18 Willy Lambert wrote:
> 2011/3/1 Peter Soetens <peter [..] ...>
>
> > On Tuesday 01 March 2011 00:37:07 Willy Lambert wrote:
> > > Hi all,
> > >
> > > I am trying to build a component library (composed of several
> >
> > components).
> >
> > > The compilation failed with a stanged error that I don't understand :
> > > -> undefined reference to `RTT::(anonymous
> > > namespace)::ComponentFactories::Factories'
> > >
> > > After reading the result of the verbose make command, the compiler
> >
> > command
> >
> > > seems strange when linking components :
> > > -> /usr/bin/c++ [..] -larp-core-gnulinux
> >
> > /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux
> > .s
> >
> > > o.2.2.1 -lSUSI-3.02 [...]
> > >
> > > By the way, there is 2 Component.hpp files : one in rtt, and one in
> > > ocl. Which is the rigth one ? If one is no more used, could the API be
> > > depracated ?
> >
> > Both are valid and identical, you only need to include one, we recommend
> > including the RTT one for new components though (see:
> >
> > http://www.orocos.org/stable/documentation/rtt/v2.3.x/doc-xml/orocos-rtt-
> > changes.html
>
> thanks
>
> > The error you get is explained by the fact that you didn't write
> > ORO_CREATE_COMPONENT_TYPE()
> > in your library sources. In 2.3, this macro is renamed to
> >
> > ORO_CREATE_COMPONENT_LIBRARY() (old name also st stilll available).
> >
> > See also:
> > http://www.orocos.org/stable/documentation/ocl/v2.x/doc-xml/orocos-deploy
> > ment.html "Section 3: Setting up a deployable component library"
>
> hum... I am surprised as it is a port of the code I used to compile in the
> standalone orocos toolchain and I am now trying to "copy paste" it in my
> project done in the orocos_toolchain_ros. I must have forgot something
> somewhere, I'll have a look.
>
> I don't know if it is technically possible to change this error output
> text, but it is not direct to switch from
>
> PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
> namespace)::ComponentFactories::Factories'
> /usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation R_386_GOTOFF
> against undefined symbol `RTT::(anonymous
> namespace)::ComponentFactories::Factories' can not be used when making a
> shared object
>
> to "Oh god I forgot once again the macros" :p

Well, that's an idea. We can't have it happen like this, but maybe we could
have component libraries link to a tiny rtt library that contains only this
symbol. You could still opt-in, ie, OR you use the macro yourself, OR you link
against this library. The UseOrocos-RTT.cmake macros could even do this
automatically, and disable the ORO_CREATE_COMPONENT_LIBRARY macro
if that's the case...

This could then 'deprecate' the ORO_CREATE_COMPONENT macro all-together,
leaving less confusions for users, ie, only one macro to use & know.

>
> > > Extract of make VERBOSE=2 result :
> > >
> > > Linking CXX shared library ../../lib/libarp-hml-gnulinux.so
> > > cd /media/DD_data/home/ard/ros/ard/arp_hml/build/src && /usr/bin/cmake
> > > -E cmake_link_script CMakeFiles/arp-hml.dir/link.txt --verbose=2
> > > /usr/bin/c++ -fPIC -DRTT_COMPONENT -Os -DNDEBUG -Wl,-z,defs -shared
> > > -Wl,-soname,libarp-hml-gnulinux.so -o ../../lib/libarp-hml-gnulinux.so
> > > CMakeFiles/arp-hml.dir/HML.cpp.o CMakeFiles/arp-hml.dir/PCM3362.cpp.o
> > > CMakeFiles/arp-hml.dir/can/dictionnary/CanARD.c.o
> > > CMakeFiles/arp-hml.dir/can/CanOpen.cpp.o
> > > CMakeFiles/arp-hml.dir/joystick/Joystick.cpp.o
> > > CMakeFiles/arp-hml.dir/joystick/GamepadPS1.cpp.o
> > > CMakeFiles/arp-hml.dir/joystick/DefaultJoystick.cpp.o
> > > -L/media/DD_data/home/ard/ros/ard/arp_core/lib
> > > -L/home/ard/ros/orocos_toolchain_ros/ocl/lib
> > > -L/home/ard/ros/orocos_toolchain_ros/log4cpp/install/lib
> > > -L/home/ard/ros/orocos_toolchain_ros/rtt/install/lib*
> > > -larp-core-gnulinux
> >
> > /home/ard/ros/orocos_toolchain_ros/rtt/install/lib/liborocos-rtt-gnulinux
> > .s
> >
> > > o.2.2.1 -lSUSI-3.02* -lcanfestival_unix -lcanfestival
> >
> > -lboost_filesystem-mt
> >
> > > -lboost_system-mt -lboost_serialization-mt -lpthread -lrt -ldl
> >
> > -Wl,-rpath,/media/DD_data/home/ard/ros/ard/arp_core/lib:/home/ard/ros/oro
> > co
> >
> > s_toolchain_ros/ocl/lib:/home/ard/ros/orocos_toolchain_ros/log4cpp/instal
> > l/
> >
> >
lib:/home/ard/ros/orocos_toolchain_ros/rtt/install/lib:::::::::::::::::::::
> > > CMakeFiles/arp-hml.dir/PCM3362.cpp.o: In function `global constructors
> > > keyed to PCM3362.cpp':
> > > PCM3362.cpp:(.text+0x1cff): undefined reference to `RTT::(anonymous
> > > namespace)::ComponentFactories::Factories'
> > > /usr/bin/ld: CMakeFiles/arp-hml.dir/PCM3362.cpp.o: relocation
> >
> > R_386_GOTOFF
> >
> > > against undefined symbol `RTT::(anonymous
> > > namespace)::ComponentFactories::Factories' can not be used when making
> > > a shared object
> > > /usr/bin/ld: final link failed: Bad value
> > > collect2: ld returned 1 exit status
> > >
> > > Here is the export part of my manifest :
> > > <export>
> > >
> > > <cpp cflags="-I${prefix}/src" lflags="-Wl,-rpath,${prefix}/lib
> > >
> > > -L${prefix}/lib -larp-core-gnulinux"/>
> > >
> > > <rosbuild cmake_directory="${prefix}/cmake" />
> > >
> > > <export>
> > >
> > > Here is the Cmake code :
> > > file(
> > >
> > > GLOB_RECURSE
> > > source_files
> > > *.c*
> > >
> > > )
> > >
> > > orocos_component(arp-hml ${source_files})
> > > target_link_libraries(arp-hml SUSI-3.02)
> > > #target_link_libraries(arp-hml arp-hml-can-dico)
> > > target_link_libraries(arp-hml canfestival_unix)
> > > target_link_libraries(arp-hml canfestival)
> >
> > Peter

Peter