Linking error in OCL when cross-compiling

I forgot to mention that I'm using the master git tree, not the official 2.1
release.

2010/11/12 Philippe Hamelin <philippe [dot] hamelin [..] ...>

> Hello,
>
> I'm currently cross-compiling RTT and OCL for a PowerPC architecture.
> Cross-compilation of RTT worked so far using the following CMake script:
>
>

> # this one is important
> SET(CMAKE_SYSTEM_NAME Linux)
>
> #this one not so much
> SET(CMAKE_SYSTEM_VERSION 1)
>
> # specify the cross compiler
> SET(CMAKE_C_COMPILER
> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-gcc)
> SET(CMAKE_CXX_COMPILER
> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++)
>
> # where is the target environment
> SET(CMAKE_FIND_ROOT_PATH
>  /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/)
>
> # search for programs in the build host directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>
> # for libraries and headers in the target directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> 

>
> However, when compiling OCL I'm getting an error while linking the
> cdeployer :
>
> Linking CXX executable cdeployer-gnulinux
> cd /home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/bin &&
> /usr/bin/cmake -E cmake_link_script
> CMakeFiles/cdeployer-gnulinux.dir/link.txt --verbose=1
> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++ -O2
> -g CMakeFiles/cdeployer-gnulinux.dir/cdeployer.cpp.o
> CMakeFiles/cdeployer-gnulinux.dir/deployer-funcs.cpp.o -o
> cdeployer-gnulinux -rdynamic
> -L/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
> ../deployment/liborocos-deployment-corba-gnulinux.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_program_options.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniORB4.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniDynamic4.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomnithread.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOS4.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOSDynamic4.so
> ../deployment/liborocos-deployment-gnulinux.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_filesystem.so
> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_system.so
> -lpthread -lrt -ldl
> -Wl,-rpath,/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib:/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/deployment:/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib:
> /opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
> warning: librtt-marshalling-gnulinux.so.2.1.0, needed by
> ../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
> or -rpath-link)
> /opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
> warning: librtt-scripting-gnulinux.so.2.1.0, needed by
> ../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
> or -rpath-link)
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyLoader::configure(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*,
> bool) const'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyDemarshaller::deserialize(RTT::PropertyBag&)'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyDemarshaller::~PropertyDemarshaller()'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyLoader::save(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*,
> bool) const'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyDemarshaller::PropertyDemarshaller(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&)'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::Scripting::Scripting(RTT::TaskContext*)'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `typeinfo for RTT::Scripting'
> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
> `RTT::marsh::PropertyLoader::load(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*)
> const'
> collect2: ld returned 1 exit status
> make[2]: *** [bin/cdeployer-gnulinux] Error 1
> make[2]: Leaving directory
> `/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
> make[1]: *** [bin/CMakeFiles/cdeployer-gnulinux.dir/all] Error 2
> make[1]: Leaving directory
> `/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
> make: *** [all] Error 2
>
> It seems that it doesn't link to plugins (marshalling and scripting) even
> if they are in my target FS
> (/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/orocos/plugins).
> The generated linker command just doesn't include any reference to these two
> libraries. Before looking further in the CMake scripts, does anyone have an
> idea how to solve this problem?
>
> Thank you,
>
> Philippe Hamelin
>

Linking error in OCL when cross-compiling

Here is more information about this bug.

I tested the cross-compilation with the official 2.1.0 release and both
RTT/OCL worked fine. Looking at the differences between the master branch
and the 2.1.0, I see that there is major difference in the CMakeLists.txt
file for the deployment library. I suspect that this modification broke the
cross-compilation using CMake.

In 2.1.0, the GLOBAL_ADD_COMPONENT and COMPONENT_ADD_LIBS macros are used,
which append e.g. "-gnulinux" to the target name (not only to the
OUTPUT_NAME). However, in the master branch, the orocos_library macro and
the CMake command TARGET_LINK_LIBRARIES are used. For the latter, the
"-gnulinux" is only added to the OUTPUT_NAME.

I suspect that the problem is something around that but I can't figure it
out. Any help would be very appreciated!

Philippe Hamelin

2010/11/12 Philippe Hamelin <philippe [dot] hamelin [..] ...>

> I forgot to mention that I'm using the master git tree, not the official
> 2.1 release.
>
> 2010/11/12 Philippe Hamelin <philippe [dot] hamelin [..] ...>
>
> Hello,
>>
>> I'm currently cross-compiling RTT and OCL for a PowerPC architecture.
>> Cross-compilation of RTT worked so far using the following CMake script:
>>
>>

>> # this one is important
>> SET(CMAKE_SYSTEM_NAME Linux)
>>
>> #this one not so much
>> SET(CMAKE_SYSTEM_VERSION 1)
>>
>> # specify the cross compiler
>> SET(CMAKE_C_COMPILER
>> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-gcc)
>> SET(CMAKE_CXX_COMPILER
>> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++)
>>
>> # where is the target environment
>> SET(CMAKE_FIND_ROOT_PATH
>>  /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/)
>>
>> # search for programs in the build host directories
>> SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>>
>> # for libraries and headers in the target directories
>> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>> 

>>
>> However, when compiling OCL I'm getting an error while linking the
>> cdeployer :
>>
>> Linking CXX executable cdeployer-gnulinux
>> cd /home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/bin &&
>> /usr/bin/cmake -E cmake_link_script
>> CMakeFiles/cdeployer-gnulinux.dir/link.txt --verbose=1
>> /opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++ -O2
>> -g CMakeFiles/cdeployer-gnulinux.dir/cdeployer.cpp.o
>> CMakeFiles/cdeployer-gnulinux.dir/deployer-funcs.cpp.o -o
>> cdeployer-gnulinux -rdynamic
>> -L/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
>> ../deployment/liborocos-deployment-corba-gnulinux.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_program_options.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniORB4.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniDynamic4.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomnithread.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOS4.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOSDynamic4.so
>> ../deployment/liborocos-deployment-gnulinux.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_filesystem.so
>> /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_system.so
>> -lpthread -lrt -ldl
>> -Wl,-rpath,/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib:/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/deployment:/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib:
>> /opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
>> warning: librtt-marshalling-gnulinux.so.2.1.0, needed by
>> ../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
>> or -rpath-link)
>> /opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
>> warning: librtt-scripting-gnulinux.so.2.1.0, needed by
>> ../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
>> or -rpath-link)
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyLoader::configure(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*,
>> bool) const'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyDemarshaller::deserialize(RTT::PropertyBag&)'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyDemarshaller::~PropertyDemarshaller()'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyLoader::save(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*,
>> bool) const'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyDemarshaller::PropertyDemarshaller(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&)'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::Scripting::Scripting(RTT::TaskContext*)'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `typeinfo for RTT::Scripting'
>> ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
>> `RTT::marsh::PropertyLoader::load(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&, RTT::TaskContext*)
>> const'
>> collect2: ld returned 1 exit status
>> make[2]: *** [bin/cdeployer-gnulinux] Error 1
>> make[2]: Leaving directory
>> `/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
>> make[1]: *** [bin/CMakeFiles/cdeployer-gnulinux.dir/all] Error 2
>> make[1]: Leaving directory
>> `/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
>> make: *** [all] Error 2
>>
>> It seems that it doesn't link to plugins (marshalling and scripting) even
>> if they are in my target FS
>> (/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/orocos/plugins).
>> The generated linker command just doesn't include any reference to these two
>> libraries. Before looking further in the CMake scripts, does anyone have an
>> idea how to solve this problem?
>>
>> Thank you,
>>
>> Philippe Hamelin
>>
>
>

Linking error in OCL when cross-compiling

Hello,

I'm currently cross-compiling RTT and OCL for a PowerPC architecture.
Cross-compilation of RTT worked so far using the following CMake script:

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
 
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
 
# specify the cross compiler
SET(CMAKE_C_COMPILER
/opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER
/opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++)
 
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH
 /home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/)
 
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

However, when compiling OCL I'm getting an error while linking the cdeployer
:

Linking CXX executable cdeployer-gnulinux
cd /home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/bin &&
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cdeployer-gnulinux.dir/link.txt --verbose=1
/opt/x-tools/powerpc-nofpu-linux-gnu/bin/powerpc-nofpu-linux-gnu-g++ -O2
-g CMakeFiles/cdeployer-gnulinux.dir/cdeployer.cpp.o
CMakeFiles/cdeployer-gnulinux.dir/deployer-funcs.cpp.o -o
cdeployer-gnulinux -rdynamic
-L/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
../deployment/liborocos-deployment-corba-gnulinux.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_program_options.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-corba-gnulinux.so.2.1.0
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniORB4.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomniDynamic4.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libomnithread.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOS4.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib/libCOSDynamic4.so
../deployment/liborocos-deployment-gnulinux.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/liborocos-rtt-gnulinux.so.2.1.0
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_filesystem.so
/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/libboost_system.so
-lpthread -lrt -ldl
-Wl,-rpath,/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib:/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build/deployment:/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/lib:
/opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
warning: librtt-marshalling-gnulinux.so.2.1.0, needed by
../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
or -rpath-link)
/opt/x-tools/powerpc-nofpu-linux-gnu/lib/gcc/powerpc-nofpu-linux-gnu/4.4.3/../../../../powerpc-nofpu-linux-gnu/bin/ld:
warning: librtt-scripting-gnulinux.so.2.1.0, needed by
../deployment/liborocos-deployment-gnulinux.so, not found (try using -rpath
or -rpath-link)
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyLoader::configure(std::basic_string<char,
std::char_traits bool) const'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyDemarshaller::deserialize(RTT::PropertyBag&)'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyDemarshaller::~PropertyDemarshaller()'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyLoader::save(std::basic_string<char,
std::char_traits bool) const'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyDemarshaller::PropertyDemarshaller(std::basic_string<char,
std::char_traits ../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::Scripting::Scripting(RTT::TaskContext*)'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`typeinfo for RTT::Scripting'
../deployment/liborocos-deployment-gnulinux.so: undefined reference to
`RTT::marsh::PropertyLoader::load(std::basic_string<char,
std::char_traits const'
collect2: ld returned 1 exit status
make[2]: *** [bin/cdeployer-gnulinux] Error 1
make[2]: Leaving directory
`/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
make[1]: *** [bin/CMakeFiles/cdeployer-gnulinux.dir/all] Error 2
make[1]: Leaving directory
`/home/hamelinp/devroot/xilinx/orocos/orocos-toolchain-ocl/build'
make: *** [all] Error 2

It seems that it doesn't link to plugins (marshalling and scripting) even if
they are in my target FS
(/home/hamelinp/devroot/xilinx/buildroot-2010.08/output/staging/usr/lib/orocos/plugins).
The generated linker command just doesn't include any reference to these two
libraries. Before looking further in the CMake scripts, does anyone have an
idea how to solve this problem?

Thank you,

Philippe Hamelin