Note: This page describes how to compile the MRPT from the sources. If you are just interested in Windows binaries, go straight to the download page and get the win32 binary package. The list of supported platforms and compilers can be found here.


Please, report errors or doubts on MRPT compilation to mrpt-help@lists.sourceforge.net (See the archive of all messages).

 

Get from your repository:
target_url=http://babel.isa.uma.es/mrpt/index.php/MRPT_in_GNU/Linux_repositories image_url=http://babel.isa.uma.es/mrpt/images/e/ee/Linux-logos.png caption=See installation instructions for pre-compiled and development MRPT packages.

 

__TOC__

Compiling on Windows

Prerequisites - Windows

CMake

To install the CMake build system, follow the instructions at http://www.cmake.org/HTML/Download.html.

wxWidgets

In addition to the following notes, read the project's wiki: http://wiki.wxwidgets.org/MSVC

The source package for the wxWidgets library (named "wxALL" or "wxMSW", currently version 2.8.9) must be downloaded from here and decompressed in a directory where CMake can find it (e.g. C:\wxWidgets).

In Windows you'll have to manually modify the flag to compile the OpenGL support of wxWidgets. This is achieved by setting wxUSE_GLCANVAS to 1 (the default is 0). This is the part of the file

wxwidgets\include\wx\msw\setup.h 

that has to be modified:

// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
// set to 1. Note that for some compilers (notably Microsoft Visual C++) you
// will need to manually add opengl32.lib and glu32.lib to the list of
// libraries linked with your program if you use OpenGL.
//
// Default is 0.
//
// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise
#define wxUSE_GLCANVAS       1

Now, depending on the version of wxWidgets:

=== wxWidgets < 2.9.0 =====

The wxWidgets library can be compiled by opening the Visual Studio project wxwidgets\build\msw\wx.dsw. Remember to compile, with Build all the configurations:

Note: If both ANSI and Unicode versions of wxWidgets have been compiled, make sure that wxWidgets_CONFIGURATION is set to msw instead of mswu to avoid some linking errors.

=== wxWidgets >= 2.9.0 =====

Compile wxWidgets by opening the Visual Studio solution wxwidgets\build\msw\wx_vcX.sln.

Unless you want to build MRPT as static libs (.lib) instead of dynamic ones (.dll, the recommended way), I recommend to compile wxWidgets in these configurations only:


Boost

For MRPT>=0.7.2: Boost is no longer required to build MRPT.

Boost libraries are optional when compiling MRPT since only these programs require it:

and they'll be not compiled if Boost is not found.

Precompiled versions of Boost can be downloaded from http://www.boostpro.com/products/free/ for different Visual C++ compilers and configurations. If you prefer to compile from sources, follow instructions from http://www.boost.org/

To avoid problems, download all the configurations (Multithread DLL, Multithread static, etc...) for your compiler version (VC7, VC8, etc...).

And select (at least) these components for download:

Remember to include the boost/lib directory in the system PATH.


OpenCV

It is recommended to compile MRPT against OpenCV 2.0.0 in order to enjoy the new features such as SURF descriptors. See the instructions in: http://opencv.willowgarage.com/wiki/InstallGuide

One interesting option is to compile a SVN snapshot of OpenCV:

Checkout a fresh copy of the development branch by executing: (NOV-2009: OpenCV hosting changed, this is the new SVN uri:)

svn co https://code.ros.org/svn/opencv/trunk/opencv/ opencv

or use the graphical program TortoiseSVN.

Then follow [https://code.ros.org/svn/opencv/trunk/opencv/INSTALL the compiling instructions]. Once compiled with CMake, running "Configure" in MRPT's CMake project will automatically detect the OpenCV 1.1.0 directory and will use it. If it's not detected, set OpenCV_DIR to the build directory of OpenCV.


FFmpeg for Win32

The FFmpeg libraries are optional, and they are only needed if you want to use CFFMPEG_InputStream, mainly for supporting IP cameras.

Directly download and decompress anywhere in your disk :

Then when running CMake (cmake-gui), enable MRPT_HAS_FFMPEG_WIN32, press "Configure" and then set FFMPEG_WIN32_ROOT_DIR to the directory where FFmpeg binaries have been uncompressed (e.g. "c:\ffmpeg-r16537-gpl-lshared-win32").

The FFmpeg DLLs will be required at runtime by programs compiled with MRPT under Windows, so make sure the directory /bin is in the system PATH.


Compiling MRPT (Under Windows)

The first step is to generate a makefile ("project", "solution") for your compiler. To achieve this execute the batch file

makefiles\win32_rebuild_XXXX_GUI.bat

according to your compiler. For example, for Visual Studio 2005, execute:

win32_rebuild_MSVC8_GUI.bat

CMake will be invoked and may ask you to configure some variables. Just select "configure" until the button "generate" enables, then press it to build the project files (more in the next section on customizing the CMake variables).

The corresponding project files will be generated in a subdirectory of makefiles (e.g. makefiles\MSVC8\MRPT_ALL.sln). [ thumb ]

Note on wxWidgets: If CMake doesn't localize your wxWidget directory, set it manually with the variable wxWidgets_ROOT_DIR and press "Configure" again. If even after that wxWidgets is not detected, enable the view of advanced variables and set manually wxWidtgets_LIB_DIR to your wxWidgets\lib\vc_lib (or vc_dll) directory.

Now, for MS Visual C++, open the solution MRPT.sln with the Visual Studio IDE, select the "Release" configuration, and compile the project "ALL_BUILD". For other compilers, invoke them from the console passing them the just generated makefiles. After compiling, the applications will be located in the bin directory and the C++ static library in lib.

If you want to install the MRPT in Windows, that is, to create a program group with links to the applications, copy them and the C++ library to "Program Files", etc., you must get a binary installer from the download page. Alternatively, you can use the "PACKAGE" target from the build solution to build your own installer (this requires NSIS).

After building the MRPT, it is advisable to associate the GUI applications with their corresponding file extensions to open MRPT files directly from the Windows explorer.


Building user programs with MRPT C++ libraries

This may be the next step for those wanting to create their own programs using MRPT.

The topic is covered in a separate tutorial.


Specific instructions for MinGW (GCC compiler for Windows)

mingw32-make -f makefile.gcc SHARED=1 USE_OPENGL=1 BUILD=release 
mingw32-make -f makefile.gcc SHARED=1 USE_OPENGL=1 BUILD=debug 
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  
CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

it means MinGW is not correctly installed in the system. Review the installation process described above.

mingw32-make

either by writing the full path (e.g. c:\MinGW\bin\mingw32-make) or by adding the "bin" directory of your MinGW installation to the system PATH. This should start the normal build process.


Compiling on Linux

Remember that precompiled packages exist, so compiling from sources is not mandatory unless you want to change the default settings, hack MRPT sources or use the SIFT image descriptor (which was left out of Linux packages due to the incompatibility of its patent and free software).

Prerequisites - Linux

Some libraries are required to be installed in the system before compiling MRPT.

It is next summarized how to install all of them for some popular distributions. To install in a different distribution simply install the required packages using the corresponding package management tool of your distribution. Note that the exact package names may vary across distributions.

About OpenCV

You can compile MRPT against OpenCV 1.0.0, or 1.1.0, but it won't compile with OpenCV 1.1.0-pre1. To employ the new features such as SURF descriptors, you'll need the latest version of OpenCV. Until a new stable version of OpenCV is released (and integrated into each distro's repositories), this must be done by compiling a SVN snapshot:

Checkout a fresh copy of the development branch by executing:

svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk/opencv/ opencvlibrary-svn

And follow [https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk/opencv/INSTALL the compiling instructions].

Under Linux, you'll need to make then make install OpenCV in order to MRPT to detect it and use the new version.


Ubuntu, Debian

Invoke:

 $ sudo apt-get install build-essential cmake libwxgtk2.8-dev \
   libwxbase2.8-dbg libwxgtk2.8-dbg libftdi-dev libglut3-dev \
   libhighgui-dev lib3ds-dev libboost-program-options-dev

If you have a modern Debian/Ubuntu, install this in addition to the packages above (they are not mandatory, but recommended):

 $ sudo apt-get install libdc1394-22-dev libavformat-dev libswscale-dev

Note: If the version 2.8 of wxWidgets is not available in your distribution, it must be installed manually.

Fedora

Execute:

 $ su -c 'yum install gcc gcc-c++ make cmake wxGTK-devel opencv-devel freeglut-devel lib3ds-devel boost-devel'

OpenSUSE

For OpenSUSE 10.X, invoke:

 $ sudo zypper install make gcc gcc-c++ cmake cmake-gui pkg-config \
      zlib-devel wxGTK-devel wxGTK-gl libusb-devel freeglut-devel \
      lib3ds boost-devel

For OpenSUSE 11.X, invoke:

 $ sudo zypper install make gcc gcc-c++ cmake cmake-gui pkg-config \
      zlib-devel wxGTK-devel wxGTK-gl libusb-devel freeglut-devel \
      lib3ds-devel boost-devel

=== Installing OpenCV on OpenSUSE =====

OpenCV must be downloaded and compiled from sources manually in OpenSUSE. Download the opencv-1.0.0.tar.gz Linux sources and follow these steps:

- Install the dependencies. This will assure some packages required by OpenCV GUI and video grabbing. Invoke:
 $ sudo zypper install make gcc gcc-c++ wxGTK-devel libdc1394-devel libraw1394-devel libpng-devel libjpeg-devel

Optionally, if you enable the "Packman repository", the package ffmpeg should be also installed.

- Decompress the tarball:
 tar -xf opencv-1.0.0.tar.gz
- Then go to the newly created directory and invoke the configure tool:
 ./configure

If everything goes ok, no error will be reported as all the dependencies are satisfied. Now compile and install OpenCV with:

 make && sudo make install && sudo /sbin/ldconfig

CentOS

Some packages are available through yum, others are not.

To install all the dependencies, follow these steps:

$ su -c 'yum install gcc gcc-c++ make freeglut-devel boost-devel gtk2-devel libjpeg-devel libpng-devel libtiff-devel zlib-devel expat-devel'
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
tar -xf cmake-2.6.2.tar.gz
cd cmake-2.6.2
./bootstrap
make
su -c 'make install'
su -c 'rpm -i *.rpm'
su -c 'rpm -i *.rpm'
su -c 'rpm -i *.rpm'
cannot restore segment prot after reloc: Permission denied 

Generic instructions

If your system is not covered by the GNU/Linux cases above, you'll have to install, either by compiling from sources or by installing with your package manager, at least these programs and libraries:

./configure --with-opengl



Compiling MRPT (on GNU/Linux, or Unix)

Decompress the source tarball

Extract the sources from the tar.gz file to a new directory: by invoking

 $ tar -xvzf mrpt-0.7.0.tar.gz

, a new directory with all the sources will be created (for example mrpt-0.7.0).

Invoke ccmake to generate the Makefile's

Create a new, empty directory where the projects will be compiled. For example:

 $ mkdir mrpt-release
 $ cd mrpt-release

And now invoke the ccmake GUI to configure MRPT.

 $ ccmake ../mrpt-0.6.0

(If available, use cmake-gui, which provides a real Qt-based GUI). At the beginning, the CMake cache will be empty, so press 'c' (configure) to see the initial list of options:

[ image ]

Change the parameters as desired (see the section on MRPT CMake variables), press configure until everything looks OK, then press 'g' (generate) to create the Makefile's.

Compile

To compile all the selected targets, just invoke:

   $ make

This will build the MRPT C++ libraries, and the applications (not the examples). The applications will be generated in the bin directory and the C++ static libraries in lib.

After building the MRPT it is advisable to associate the GUI applications with their corresponding file extensions in order to open files in several MRPT-defined formats directly from your OS file manager.

To see the full list of make targets, type:

   $ make help

to obtain a list of targets.

See the section on build options to compile the examples and more. It is strongly recommended to build with MRPT_OPTIMIZE_NATIVE enabled if not building for a Debug configuration (See the alternative below if you have a version of GCC <4.2).

 


Building user programs with MRPT C++ libraries

This may be the next step for those wanting to create their own programs using MRPT.

The topic is covered in a separate tutorial.


Build options

A few options are selected automatically when invoking CMake depending on, for example, the libraries found in your system. However, you can manually change these and other parameters through the CMake graphical interfaces. To invoke it:

$ ccmake .
makefiles\win32_rebuild_XXXX_GUI.bat

Currently the most useful options that can be selected manually, most of them between "ON"/"OFF", are:

ccmake .
(Linux)
cmakesetup
(Windows)

               [ thumb ]
               

               [ thumb ]
               


Summary of prerequisites

The following table summarizes the applications and libraries that you should have installed in your system before compiling the MRPT, according to the instructions above

Application/Library Optional? Required for... Consequences of building MRPT without this...
C and C++ compiler
(GNU g++,MS Visual Studio,...)
NO

-

-
CMake (2.6 or above)

NO - -
The wxWidgets library YES (*)

Compiling the GUI applications and GUI classes within the MRPT C++ library. Some applications will be not built and some classes will raise an exception if used, e.g. the CDisplayWindow class.

The OpenCV library

YES (*) - Image loading/saving, manipulation & capturing.
An exception will be raised when trying to load/save images. However there is limited image manipulation support through the class CMRPTImageFloat.
The OpenGL and GLUT libraries YES (*) - 3D scene rendering.

- The 3DSceneViewer application.

The 3DSceneViewer application will be not compiled. An exception will raise if the class CDisplayWindow3D is used.

The Digiclops & Triclops libraries (from Point Grey Research Inc.)

YES Stereo image capture from Bumblebee camera. An exception will be raised if the class CStereoGrabber_Bumblebee is used.
FTDI headers
(Unix only)
YES

Access to FTDI USB chips through the CInterfaceFTDI class.

An exception will be raised if this class is used.
Code Blocks YES Redesign the GUIs graphically.

You can still modify the GUIs by hand.

NSIS (Nullsoft Scriptable Install System) YES Building the MRPT installer for Windows. -
Boost YES Used for some programs only. The following applications will not be built: simul-gridmap, grid-matching
Doxygen YES Rebuilding the MRPT documentation. -

(*): These elements are optional but strongly recommended: the functionality of the MRPT will be severely reduced without them.


Other resources

한국어: 훈령 (Korean installation guide)

This blog contains translated building instructions:

http://blog.naver.com/PostView.nhn?blogId=hangondragon&logNo=20064072057&widgetTypeCall=true