[ros-users] Cross-Compilation Patch
Cedric Pradalier
cedric.pradalier at mavt.ethz.ch
Fri Jul 9 12:55:29 UTC 2010
Hi,
I'd like to suggest the 2 micro-patch to help cross-compiling ros.
======== ROS BUILD ========
I now use more the rostoolchain.cmake and I really think that's the way
forward. Mine looks like that:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm-angstrom-linux-gnueabi)
set(GUMSTIXTOP [...]/overo-oe)
set(GUMSTIXFS [...]/overo-dev)
set(CMAKE_C_COMPILER
${GUMSTIXTOP}/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc-sysroot)
set(CMAKE_CXX_COMPILER
${GUMSTIXTOP}/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-g++-sysroot)
set(CMAKE_FIND_ROOT_PATH ${GUMSTIXFS})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
The CMAKE_FIND... directives are conflicting with the
_rosbuild_add_rostest and _rosbuild_add_pyunit in
rosbuild/private.cmake. This can be corrected by applying the following
patch:
- find_file(_file_name ${file} ${PROJECT_SOURCE_DIR} /)
+ find_file(_file_name "${file}" "${PROJECT_SOURCE_DIR}" /
NO_CMAKE_FIND_ROOT_PATH)
in both function. This will force find_file to ignore the
CMAKE_FIND_ROOT_PATH for these functions. This is fine since they seem
to be used only to refer to local files.
======== OpenCV ========
In OpenCV, the Makefile does not use the toolchain file. I've modified
mine as follows. There might cleaner ways to get the same semantic.
CMAKE = cmake
TOOLCHAIN =
ifeq (x$(wildcard
$(ROS_ROOT)/rostoolchain.cmake),x$(ROS_ROOT)/rostoolchain.cmake)
TOOLCHAIN = -DCMAKE_TOOLCHAIN_FILE=$(ROS_ROOT)/rostoolchain.cmake
endif
CMAKE_ARGS = $(TOOLCHAIN) -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=`rospack find
opencv2`/$(INSTALL_DIR) \
...
=========================
Next thing is to find a way to generate rospack and rosstack twice, once
for host, another for deployment, and to call a different one during
compilation and at runtime. Any idea?
HTH
--
Dr. Cedric Pradalier
http://www.asl.ethz.ch/people/cedricp
More information about the ros-users
mailing list