Building and Installing Instructions

From MRPT

Jump to: navigation, search

Back to: Main page

Last update: 20 Dec. 2008

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

Get from your repository:

Linux-logos.png
See installation instructions for pre-compiled and development MRPT packages.



Contents

[hide]



Compiling on Windows

Prerequisites - Windows

Note: Only the points D-E are needed if you intend to use the MRPT binaries instead of compiling the sources.

A. CMake

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

B. 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", currently version 2.8.7) 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


Next, 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:

  • For compiling MRPT as static libraries (BUILD_SHARED_LIBS=OFF):
    • Release
    • Debug
  • For compiling MRPT as dynamic libraries (BUILD_SHARED_LIBS=ON):
    • Release DLL
    • Debug DLL



C. Boost

Required for mrpt 0.6.2 or above only. For now boost is optional since only one program requires it (simul-gridmap), and it'll be not compiled if boost is not found.

Precompiled versions 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/

Download, at least, these configurations:

  • Multithread DLL
  • Multithread Debug, DLL

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



D. OpenCV

Install OpenCV (version 1.0.0 or 1.1.0), available here. The OpenCV DLLs will be required at runtime by programs compiled with MRPT under Windows, so make sure the <OpenCV>/bin directory is in the system PATH.

For MRPT <=0.6.3: Only OpenCV 1.0.0 is supported.



E. GLUT

NOTE: The library and DLL for glut32 are NOT required for mrpt-0.6.2 or newer versions, which include a freeglut built-in.

For older MRPT versions:

Just the file glut32.dll will be required in run-time (a copy of headers and the .lib are included with MRPT packages).

A local copy of the DLL for 32-bit Windows can be grabbed from: glut32.dll.

Or visit the original project web page: http://www.xmission.com/~nate/glut.html



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).


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.


Specific instructions for MinGW (GCC compiler for Windows)

  • Before compiling MRPT with MinGW, it's strongly recommended to compile wxWidgets and OpenCV with MinGW:
  • Build wxWidgets. Open a command prompt and go to the directory build/msw. Then execute the following commands to rebuild the Release and Debug configurations, so CMake can correctly detect wxWidgets:
mingw32-make -f makefile.gcc USE_OPENGL=1 BUILD=release 
mingw32-make -f makefile.gcc USE_OPENGL=1 BUILD=debug 
  • Build OpenCV. Use the new CMake build system (to be shipped with the next OpenCV 1.1.0 release), select the MinGW compiler and follow the generic OpenCV compilation instructions.
  • Open cmake-gui and select the source directory and an empty target (binary) directory.
  • Press configure and in the compilers dialog pick MinGW Makefiles. If you obtain an error like:
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.

  • If everything goes fine, you'll see the new CMake variables remarked in red. Go through the normal configuration process for MRPT, and when you are satisfied, press Generate.
  • Open a console and in the newly created binary directory, invoke:
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 or hack MRPT sources.


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.

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

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

For MRPT 0.6.4: If you have a modern Debian/Ubuntu, install this in addition to the packages above:

 $ sudo apt-get install libdc1394-22-dev

Fedora

Invoke as root:

 # yum install gcc gcc-c++ make cmake wxGTK-devel opencv-devel freeglut-devel lib3ds-devel boost-devel

OpenSUSE

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 libboost-program-options
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

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.6.0.tar.gz

, a new directory with all the sources will be created (for example mrpt-0.6.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:ccmake_init.png

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).


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:

  • In Linux, go to the binary directory (where ccmake was invoked the first time) and type:
$ ccmake .
  • In Windows, execute the following batch file, which calls cmakesetup:
makefiles\win32_rebuild_XXXX_GUI.bat


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

  • For all platforms/compilers:
    • BUILD_SHARED_LIBS: Build static libraries if set to OFF, or dynamic libraries (.so/.dll) otherwise. Default is OFF in Windows, ON in Linux.
    • BUILD_EXAMPLES: Whether you want to compile all the examples in the "/samples" directory. Default is OFF.
    • MRPT_HAS_BUMBLEBEE: To enable integration of the Bumblebee stereo camera SDK. You'll need the vendor provided "Triclops" and "Digiclops" libraries. After setting this option to "ON", the new configuration fields "BUMBLEBEE_DIGICLOPS_ROOT_DIR" and "BUMBLEBEE_TRICLOPS_ROOT_DIR" will appear where the correct corresponding paths must be entered.
    • MRPT_ALWAYS_CHECKS_DEBUG: If set to ON, additional security checks will be performed at run-time in many classes. Default is OFF.
    • MRPT_ALWAYS_CHECKS_DEBUG_MATRICES: If set to ON, additional security checks will be performed at run-time in several Matrix operations. Default is ON.
    • MRPT_OCCUPANCY_GRID_CELLSIZE: Can be either 8 or 16 (bits). The size of each cell in the class mrpt::slam::COccupancyGridMap2D. Default is 8 bits. More on this here.
    • USER_EXTRA_CPP_FLAGS: You can add here whatever additional flags to be passed to the compiler.
    • MRPT_HAS_ASIAN_FONTS: Enables Asian fonts in CMRPTCanvas (see wiki page), but increases library size by 1.5Mb. Default is OFF.
    • BUILD_xSENS: Whether to use the CMT library for interfacing xSens inertial sensors. After setting this variable to ON, a new variable ROOT_xSENS will appear which must be set to the source code provided by the library (The subdirectory "CMTSrc"). Be sure of installing the updated version from the manufacturer (at least the version released in Aug, 2008).
  • Microsoft Visual Studio:
    • CMAKE_MRPT_HAS_VLD: Whether to include the Visual Leak Detector (VLK). Default is OFF. If enabled, the new variable ROOT_VISUAL_LEAK_DETECTOR will appear which must be pointed to the VLD root directory.
  • GNU GCC compiler only:
    • MRPT_ENABLE_LIBSTD_PARALLEL_MODE: Enables the GNU libstdc++ parallel mode (See http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html). Default is OFF.
    • MRPT_ENABLE_PROFILING: Enables generation of information required for profiling. Default is OFF.
    • MRPT_OPTIMIZE_NATIVE: Enables optimization for the current architecture (-mtune=native). Default is OFF for old GCC versions, ON for 4.2+. If you have an old version of GCC (<4.2), this option cannot be set since it's not recognized by the compiler. Instead, set USER_EXTRA_CPP_FLAGS to the optimization flags for your platform, for example: -march=pentium4.


ccmake .
(Linux)
cmakesetup
(Windows)


Creating new programs with the MRPT C++ library

This may be the next step for those who want to create their own programs using the MRPT library. The topic is covered in a separate tutorial.




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.4.7 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 UTILS::CDisplayWindow2D 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 UTILS::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 UTILS::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 MRVL::CStereoGrabber_Bumblebee is used.

FTDI headers
(Unix only)

YES

Access to FTDI USB chips through the HWDRIVERS::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.




Back to: Main page

Views