(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Mingw Cross and Native Mingw Compatibility

Description: Often you'll need to transfer some mingw_cross built libs to a native mingw windows environment so that you can finish development. Either its because your colleagues are using windows, or you have other libraries already built in the native mingw environment that you cant rebuild with mingw_cross. This guide was written based on Guillaume Walck's experiences.

Keywords: mingw

Tutorial Level: ADVANCED

Installing Sources

This assumes that you already have the ros and eros sources enabling a mingw build as described here.

Extracting Mingw Cross

When installing mingw_cross, only download/extract the sources.

rosdep install mingw_cross
roscd mingw_cross
make extract               # extracts mingw-cross in /opt/mingw

Gcc Customisations

Gcc must be compiled with almost the same configuration options as in windows. Currently mingw gcc is version 4.5.2 on windows and totally disables sjlj-exceptions and forces dwarf2. The same must be set in linux mingw-cross gcc.

cd /opt/mingw/src/
<yourfavorite editor> gcc.mk
  • In gcc build options add

        --with-dwarf2 \
        --enable-static \
        --disable-sjlj-exceptions \
  • Compile the whole suite

cd /opt/mingw
make gcc apr apr-util log4cxx boost qt

Cross Compiling

At this step you are ready to cross compile the minimal set of packages for ros communications.

Transfer

Copy the ros compiled libraries as well as the mingw_cross boost libs, libapr-1.a, libaprutil-1.a, libexpat.a, libiconv.a liblog4cxx.a in /opt/mingw/usr/i686-pc-mingw32/lib.

Linking in Windows

Simply set build options for your program to link to your lib, to boost libs, and to several roslibs (libros.a, librosconsole.a, libroscpp_serialization.a, librostime.a, libXmlRpc.a), and deps (libapr-1.a, libaprutil-1.a, libexpat.a, libiconv.a liblog4cxx.a).

Wiki: mingw_cross/Tutorials/Mingw Cross - Native Mingw Compatibility (last edited 2011-10-16 23:36:48 by DanielStonier)