Saturday, October 12, 2013

Compiling PCL/KinFu

Here are the steps to compile the PCL (including KinFu and KinFu large scale) on Linux (Ubuntu 12.04).

KinFu is not available from the compiled binaries, it needs to be compiled from the sources (branch master).

Here are the steps to follow as of 12/10/2013:
The easiest is probably to install the latest PCL package (so the dependencies are installed automatically):
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl 
sudo apt-get update
sudo apt-get install libpcl-all
Install git, CMake using the package manager...
Clone the sources
git clone
Build folder
Get in the source's main folder and create a build directory, get in it

Configure your CMake project using ccmake. ccmake is a tool which helps handling cmake files, it is installed with package cmake-curses-gui.
sudo apt-get install cmake-curses-gui

The configuration itself:

ccmake ..

Make sure you enable the following options (you need to have the CUDA toolkit installed and be in ccmake's advanced mode to have these show):

CUDA_HOST_COMPILER /usr/bin/gcc-4.6 (or your CUDA-compatible gcc version)
cmake -DCMAKE_BUILD_TYPE=Release ..

Also check you have these variables set (should already ben ON):
BUILD_gpu_kinfu ON
BUILD_gpu_kinfu_large_scale ON

CMake produces the makefile (and other files) in the build directory itself.
Make the binaries
(sudo) make install
All produced files (bin, lib, obj...) are stored in the build folder

Installing the CUDA toolkit and SDK:
The CUDA toolkit package contains both the toolkit and the SDK (samples). It is a real pain to install:
  • Do not install the graphics driver: nVidia's support for Linux seems to be rather loose and it is likely you update to a faulty driver version which prevents X to start. I had to reinstall Ubuntu because of this.
  • nVidia advises to install the distribution-specific package (managed package .deb which loads in the Ubuntu Software Center) but it did not work for me, the Software Center said the package was faulty.
  • Now when you install the distribution-agnostic package (.run file):

    • Do not accept the graphics driver update (for the above mentioned reason)
    • The installer tells you that CUDA is incompatible with gcc version 4.7.4. So it does not work either...

  • The idea is thus to use Ammar Qammaz' script which uses a different version of gcc
<CUDA toolkit>.run -override compiler
      • Install a compatible version of gcc (4.4) and sets nvcc to use it
Add option compiler-bindir in nvcc's profile
Potentially useful links:

No comments:

Post a Comment