Notice
This documentation was maintained for diamondback - it is no longer supported and may be somewhat broken! Please move to electric and use the current documentation.
Install Sources
For the purposes of illustration, this tutorial will begin by installing a working build environment from scratch in /opt/ros, but you could just as easily overlay the rosinstalls on top of an existing environment.
Make sure you have user permissions wherever you install, Executing sudo rosinstall will lead to problems later.
You can be inclusive of other stacks as well, but the minimal requirement currently consists of ros + ros_comm + eros. Additionally win_ros is needed if you want to execute roscore in windows. The win-ros-pkg repository has a rosinstaller file that can be conveniently used to quick start or as a template to expand upon.
Commands:
> sudo mkdir /opt/ros > sudo chown ${USER}:${USER} /opt/ros > rosinstall /opt/ros "http://win-ros-pkg.googlecode.com/svn/stacks/win_ros/tags/diamondback/winmaster_diamondback.rosinstall" > cd /opt/ros > . ./setup.bash > echo "export PATH=`rospack find eros_python_tools`/scripts:\${PATH}" >> /opt/ros/setup.sh > . ./setup.bash
Validation:
> cat /opt/ros/setup.sh | grep eros | grep ROS // you should see // export ROS_PACKAGE_PATH=/opt/ros/eros:/opt/ros/ros_comm > cat /opt/ros/setup.sh | grep eros_scripts // you should see // export PATH=/opt/ros/eros/tools/eros_python_tools/scripts:${PATH}
Note, you'll need diamondback or later variants for the stack versions you decide to pull on, ros/eros/win_ros only have patched in support for this from this point on.
We hope to support apt-get sometime, but is as yet currently unavailable - hopefully for the next ros release. At any rate, rosinstalls are wonderfully convenient when cross-compiling because it lets you easily manage two branches on your system, one for native builds, one for cross-compiles.
Mingw Toolchain
For an alternative scenario in which you wish to build a subset of ros libraries before transerring to a native windows mingw environment where development is to be completed, follow this tutorial instead.
If you plan to do all your windows development within the ros mingw_cross build environment, then follow the instructions below.
Commands:
> rosdep install mingw_cross > roscd mingw_cross > make # installs mingw-cross in /opt/mingw and builds gcc, boost, qt > make links # installs links in /usr/local/bin for i686-pc-mingw32 tools
It may ask you for your password to ensure that it installed to /opt/mingw with user permissions. Note, the build step above takes a long time.
Validation:
> cd /opt/mingw > make gcc apr apr-util log4cxx boost qt // you should see // make: Nothing to be done for `gcc'. // make: Nothing to be done for `apr'. // make: Nothing to be done for `apr-util'. // make: Nothing to be done for `log4cxx'. // make: Nothing to be done for `boost'. // make: Nothing to be done for `qt'.
If ever your /opt/mingw installation becomes accidentally cluttered with root protected files, run sudo chown -R ${USER}:${USER} /opt/mingw to restore it to user permissions (the scripts in mingw_cross have problems with sudo).
Cross Compile
Full Ros - fully detailed notes on how to cross-compile ros itself.
The quick-start version to cross-compiling ros with mings is below:
Commands:
> rostoolchain select mingw_cross/i686-pc-mingw32 > rosprotect --unprotect --comms # only necessary if you've previously rosprotected before > rosprotect --pre-clean --comms # ~ rosmake --pre-clean roslib rosconsole roscpp std_msgs
Validation:
> roscd roscpp/lib > ls // you should see // libros.a
Note that this uses the mingw_cross/i686-pc-mingw32 configuration selected earlier for the global ros environment, so all packages will now be cross-compiled as mingw32 packages.