[Documentation] [TitleIndex] [WordIndex

Mingw Build Environment

Description: A cross-compiling build environment for mingw programs.

Keywords: mingw

Tutorial Level: INTERMEDIATE

Next Tutorial: Mingw Packages Mingw Qt-Ros Packages

New in electric


This is for the control roboticists who love working in linux and get flustered when asked to build windows apps for the rest of the world (namely users/test engineers). It also allows a write once, compile in linux and windows approach to developing gui programs when used with qt.



For now we're using a rosinstall'ed environment which constructs a known working set around ros, ros_comm, rosbuild2, win_ros and qt_ros for electric. Once rosbuild2 is more complete, we'll be able to roll debs for it.

> wget http://win-ros-pkg.googlecode.com/svn/stacks/win_ros/trunk/mingw_electric.rosinstall
> rosinstall ~/mingw/src mingw_electric.rosinstall

Note that we're rosbuild2'ing now - which is essentially a purely cmake solution that will utilise a src and parallel build directory.

Also note that the above rosinstall will have done the defunctory native compile on your source directory. This is useful as it means you can utilise the existing setup.sh to help you traverse the source tree.

Final touches:

> cp ~/mingw/src/cmake/CMakeLists.txt ~/mingw/src


Installing the mingw_cross toolchain to /opt/mingw (it will use sudo, so enter your password when requested).

> . ~/mingw/src/setup.sh
> rosdep install mingw_cross
> roscd mingw_cross
> make
# enter password for sudo when requested



> . ~/mingw/src/setup.sh
> mkdir ~/mingw/build
> cd ~/mingw/build
> cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw/src/win_ros/mingw/mingw_build/i686-pc-mingw32.cmake ../src
> cd roscpp_tutorials; make -j5; cd ..
> cd qt_tutorials; make -j5; cd ..

Note the -j# option sets up parallel builds (same affect as ROS_PARALLEL_JOBS for rosbuild1) which is useful for speeding things up on a multi-core system.

Modifying the Build

> . ~/mingw/src/setup.sh
> cd ~/mingw/build
> ccmake .

You can then change variables such as the build type (actually, that's probably the only one you really want to modify.


All the binaries are built statically. That means they are entirely self-sufficient and standalone. It also means they're big, but as we're primarily using these just for monitoring and debugging purposes, optimisation isn't a big deal.

Simply copy the binaries in ~/mingw/build/bin to your windows machine. Fire up a roscore on a linux machine and then run the qt tutorials - make sure you enter the correct variables for the ROS_MASTER_URI and ROS_IP. Alternatively you can just start a windows shell and set the environment variables before running any of the roscpp/qt tutorials.

Old Releases

The experimental diamondback release is no longer supported. The old instructions can be found here.

2011-11-19 12:27