MASCOR

Mobile Autonomous Systems
and Cognitive Robotics

PCL on Windows

Compiling PCL on Windows using Visual Studio 2012

Compiling PCL on Windows

When we wanted to setup PCL for Windows together with other libraries, we noticed that this is not a trivial task. There is a list of official precompiled binaries, limited to Visual Studio 2010 and PCL 1.6.0 at http://pointclouds.org/downloads/windows.html. We wanted to port a software from Linux to Windows requiring a version, newer than PCL 1.6.0. Moreover the ported software has dependencies to other frameworks. A compiler/compiler version needed to be found, which can generate compatible binaries for all dependencies. We found, that MSVC 12.0 was capable to do this for our specific case. For a PCL-only-setup, newer versions of MSVC should work fine.
Prior to Visual Studio we tried to use gcc with mingw and msys which led to major problems (see ‘what not to do’ section).

Prequesities:

This tutorial was tested on Windows 10 Pro x64.

Overview/Hints

If you want to understand what exactly happens during installation, this section is for you. It may also help if you run into trouble which are not covered elsewhere in this tutorial. However, if you wich to only quickly install the PCL, you may skip this section to the step-by-step explanation of how to create a working library.

With this is mind, we can start the installation step-by-step.

Getting the Sourcecode

Get pcl source code with

git clone https://github.com/PointCloudLibrary/pcl.git

Then change directory

cd pcl

and checkout the version you want to use, e.g.

git checkout pcl-1.7.2

Statisfing Dependencies

Boost

We chose exactly 1.56 for our specific project and PCL version (which, as explained above, has to embed into an environment of other libraries).
For older boost versions “boost-serialization” is not compatible with windows.
Newer boost versions on the other hand are not compatible with Visual Studio 2010. This is not an issue, if all other dependencies of your project are compatible with a newer version of VS.

Flann

Download flann source code

git clone https://github.com/mariusmuja/flann.git

flann must be compiled manually.
Creating libs for flann manually is relatively straight forward using CMake-gui, choosing Visual Studio 2013 64 Bit.

In CMake-gui:

  1. Select source code location of flann (root of cloned git repo)
  2. change build directory from “C:\Program Files\…” to a directory where you have full access rights e.g userdir
  3. Click on configure
  4. Select your compiler and System Architecture *Cmake will start to configure the project. Ignore the warnings about missing hdf5 libs and Cmake policy. If Cmake prints ‘Configuring done’ the configuration was successful.
  5. In order to create solution files for flann click generate.
  6. Now start Visual studio and open the solution file from your specified Flann build folder.

In Visual Studio:

-Select BUILD_ALL project
build Release x64 and Debug x64 Libraries. This can take some time, grab a Coffee.

Restart Visual studio with Administrator Privileges and build the INSTALL project

If this does not work directly (which was the case in MSVC 11) you can add add compileroption “/bigobj” to all projects. In Visual Studio this is done by clicking every project flann, flann_cpp, flann_s, and open the property pages. Note that you can multiselect projects. Note that the configuration is dropdown on the top of the property dialog is stet to “All Configurations”.

It is also important to recognize the options for “static” or “dynamic” linking of the “C/C++ Runtime Libray”. This is not about creating a dynamically linked (dll) or statically linked (lib). All Libraries must coincide for this option. Otherwise hard to find linking errors will occur. Usually prebuilt libraries found on the internet use dynamic linking against the runtime. On the other handy side, users will have to install the Visual Studio Runtime when they want to use the final software.

This option depends on all other libraries you use and will very likely be dynamic linking against C/C++ Runtime Library.

Eigen

Download eigen from http://eigen.tuxfamily.org/ —Tested with eigen 3.2.8
Eigen is a header only library and does not need to be compiled/configured at all.

Configure PCL

The Configuration will probably fail. Not all dependencies are met.

define path to missing Libs.

BOOST:

Choose all lib64-msvc-12.0/boost_[X]-vc12-mt[-gd]-1_56.lib libraries. e.g

BOOST_CHRONO_LIBRARY_DEBUG: <BOOST_DIR>\lib64-msvc-12.0\boost_chrono-vc120-mt-gd-1_56.lib
BOOST_CHRONO_LIBRARY_RELEASE: <BOOST_DIR>\lib64-msvc-12.0\boost_chrono-vc120-mt-1_56.lib

Be aware that you use the right libs for DEBUG (mt-gd) and RELEASE (mt).

BOOST_MPI_LIBRARY is not needed.

EIGEN:

EIGEN_INCLUDE_DIR: eigen-eigen-b30b87236a1b (hash may differ for newer versions)

FLANN:

FLAN_INCLUDE_DIR: <FLANN_GIT_DIR>\src\cpp
FLANN_LIBRARY_DEBUG: <FLANN_BUILD_DIR>\lib\Debug\flann_cpp_s.lib
FLANN_LIBRARY_RELEASE: <FLANN_BUILD_DIR>\lib\Release\flann_cpp_s.lib

Click Configure and Generate.

Notes:
If you want to use PCL 1.7.2 in a Project with c++11 enabled, PCL must also be compiled with c++11. (This might be not needed in newer versions of PCL 1.8)

COMPILE PCL

Open Visual Studio and the newly generated PCL.sln Solution.
Build ALL_BUILD” for debug and release. COFFEE TIME. After that restart Visual Studio as Administrator and Build INSTALL.

Copy Boost dll’s from your boost binaries to C:\Program Files\PCL\bin

Finally done.

What not to do