Child pages
  • pcl-trunk on Ubuntu 12.04 LTS 64bit
Skip to end of metadata
Go to start of metadata

This page describes how to install pcl-trunk on an Ubuntu 12.04 LTS 64bit machine.

It was tested most recently with pcl trunk a504a690 on 11/13/13.

  1. Uninstall any prior PCL libraries.
    • If you had installed from binary packages or used checkinstall when installing from source previously you can use sudo apt-get remove ... or sudo apt-get purge ... which also removes any (possibly modified) configuration files related to the packages. You can list any installed packages with dpkg-query -l '*pcl*', though it is possible some packages have "pcl" in their name but are not related.
    • If you had previously installed from source using make install and you know the location of the source tree you can run make uninstall.
    • Otherwise one method is to run find /usr/local -name '*pcl*' and then judiciously remove files manually. Of course PCL may have installed some files which don't include the string "pcl" in their name or you may have installed to a different location than /usr/local.
  2. Uninstall any prior OpenNI and Sensor libraries. Use apt-get remove or purge as above. You can search for the packages with dpkg-query -l '*openni*' '*ps-engine*'. If you installed from source using the primesense install.sh and you know where that source tree is you can run sudo install.sh -u to uninstall. The README files in the primesense source trees also state what gets installed and where (but be advised that patches commonly applied to these trees may modify the install names and locations and may not update those READMEs).
  3. To install NVidia binary driver and CUDA see here.
  4. Use packages from the standard Ubuntu 12.04 repository as much as possible:
    sudo apt-get install libboost-all-dev libeigen3-dev libflann-dev libvtk5-dev libqhull-dev
    
  5. Install OpenNI 1.x binaries from the PCL PPA: This is one of several possible methods to install the primesense OpenNI 1.x (framework) and Sensor (hardware driver) libraries. I recommended this option if you don't need support for Carmine 1.09 (and probably other similarly new devices), which didn't work last I checked (11/9/13). The PCL developers have chosen and tested these versions for best support of common hardware. AFAIK for legal reasons primesense Sensor code only supports Kinect devices on Windows platforms, but with this method you get libraries that have been patched to add Kinect support on other platforms. Note: the versions you will get of these packages can depend on the Ubuntu version you are running. This page reports findings for Ubuntu 12.04.
    sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
    sudo apt-get update
    sudo apt-get install openni-dev ps-engine libusb-1.0-0-dev
    # niReg -l reports OpenNI 1.3.2.1/Sensor 5.0.3.3 (11/9/13)
    # to get matching source: mkdir pcl-ppa; cd pcl-ppa; apt-get source ps-engine openni-dev
    # to remove: sudo apt-get purge openni-dev ps-engine
    
    Package version conflicts with ROS PPA: the openni-dev and ps-engine packages are also available from the ROS PPA, but the ROS and PCL PPAs may have different versions (the libusb package is from the standard Ubuntu repository). If you are unsure from where you got a package you can check the its origin with apt-cache policy .... In the default configuration, apt-get will install the newest version of a package if multiple versions are available from different repositories. As of 7/20/13, the ROS repository has later versions of openni-dev and ps-engine than the PCL repository. Thus, if you have the ROS repository enabled, you will probably have their packages. This might work just fine, in fact Jochen recommended it as one option for installing a newer version of OpenNI 1.x in Ubuntu 12.04 than the current default version in the PCL PPA for that platform. If you prefer to stick with the PCL PPA only then one option is to disable the ROS repository (remember to apt-get update) and then remove the ROS versions of the packages before installing the PCL versions. Another option is to use the apt preferences system to "pin" these packages to the PCL PPA origin.
    Install Alternate Binaries from PPA: The PCL PPA has alternate packages which may be newer than the default ones above for some Ubuntu versions. Last I checked (11/9/13), these also didn't work with Carmine 1.09.
    sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
    sudo apt-get update
    sudo apt-get install libopenni-dev libopenni-sensor-primesense0 # note dependent pkgs libopenni0 and openni-utils will also be installed
    sudo ln -s /usr/lib/pkgconfig/libopenni.pc /usr/local/lib/pkgconfig/openni-dev.pc # if you plan to use pkg-config and want consistent naming
    # niReg -l reports OpenNI 1.5.4.0/Sensor 5.1.0.41 (11/9/13)
    # to get matching source: mkdir pcl-ppa; cd pcl-ppa; apt-get source libopenni-dev libopenni-sensor-primesense0
    # to remove: sudo apt-get purge libopenni0 openni-doc
    
    Install from Jochen Sprickerhof's github repos: I think these are the source trees from which Jochen produces packages for the PCL PPA. However, last I checked (11/9/13) they contain somewhat newer code. This does work with Carmine 1.09 (firmware 5.7.9) but with some caveats.
    mkdir jspricke && cd jspricke
    sudo apt-get install git-gui git-buildpackage g++ python libusb-1.0-0-dev freeglut3-dev openjdk-6-jdk libtinyxml-dev doxygen graphviz wget
    git clone https://github.com/jspricke/debian-openni.git # gets 9baf29ee (1/8/13) as of 11/10/13
    pushd debian-openni
    git-buildpackage --git-ignore-new --git-builder='debuild -i\\.git -I.git -us -uc'
    # if you use nvidia binary drivers you might get an error like
    # error: no dependency information found for /usr/lib/nvidia-304-updates/libGL.so.1
    # in that case do this
    # F=/var/lib/dpkg/info/nvidia-304-updates.shlibs
    # sudo cp -n $F $F.ORIG
    # sudo sh -c "cp $F.ORIG $F && echo 'libGL 1 libgl1-mesa-glx | libgl1' >> $F"
    # then try the git-buildpackage command above again
    sudo dpkg -i ../*openni*.deb
    sudo ln -s /usr/lib/pkgconfig/libopenni.pc /usr/local/lib/pkgconfig/openni-dev.pc # if you plan to use pkg-config and want consistent naming
    popd
    git clone https://github.com/jspricke/openni-sensor-primesense.git # gets 93804c51 (1/8/13) as of 11/10/13
    cd openni-sensor-primesense
    git-buildpackage --git-ignore-new --git-builder='debuild -i\\.git -I.git -us -uc'
    sudo dpkg -i ../*openni-sensor*.deb
    # niReg -l reports OpenNI 1.5.4.0/Sensor 5.1.2.1 (11/9/13)
    # to remove both openni and sensor packages: sudo apt-get purge libopenni0 openni-doc; sudo rm /usr/local/lib/pkgconfig/openni-dev.pc
    
    Install from PrimeSense git repos: This method will install the newest OpenNI and Sensor code from PrimeSense. The commands below modify build options and change the install to /usr/local but they do not enable Kinect support on non-Windows platforms like the other methods above. This also works with Carmine 1.09 with caveats. With this method you need to run most OpenNI applications like NiViewer from within the built source tree at OpenNI/Platform/Linux/Redist/*-Bin-*/Samples/Bin/x64-Release/. Also generated log files will be owned by root.
    mkdir primesense && cd primesense 
    sudo apt-get install git-gui g++ python libusb-1.0-0-dev freeglut3-dev openjdk-6-jdk libtinyxml-dev doxygen graphviz checkinstall
    git clone https://github.com/OpenNI/OpenNI.git # gets 1e9524ff (11/12/13) as of 11/13/13
    pushd OpenNI
    
    # fix hardcoded paths
    F=./Source/OpenNI/XnOpenNI.cpp
    cp -n $F $F.ORIG
    sed -e 's|/var/lib/ni|/usr/local/etc/openni|' $F.ORIG > $F
    
    # fix install paths
    F=./Platform/Linux/CreateRedist/install.sh
    cp -n $F $F.ORIG
    sed -e '/INSTALL/s|usr|usr/local| ; s|/var/lib/ni|/usr/local/etc/openni|' $F.ORIG > $F
    
    # disable sse
    F=Platform/Linux/Build/Common/Platform.x86
    cp -n $F $F.ORIG
    sed -e 's/SSE_GENERATION = 3/SSE_GENERATION = 0/ ; s/DUMMY.*/DUMMY=/' $F.ORIG > $F
    
    # fix compilation with -std=c++0x
    F=Externals/LibJPEG/jconfig.h
    cp -n $F $F.ORIG
    sed -e 's/linux/__linux__/g' $F.ORIG > $F
    F=Include/XnPlatform.h
    cp -n $F $F.ORIG
    sed -e 's/linux/__linux__/g ; s/i386/__i386__/g' $F.ORIG > $F
    
    # build
    cd Platform/Linux/CreateRedist
    sudo rm -rf ../Redist/*-Bin-*
    ./RedistMaker
    
    # install
    cd ../Redist
    D=`ls -d *-Bin*`
    V=`expr $D : ".*-v\(.*\)"`
    cd $D
    F=openni-dev.pc
    wget https://wiki.ccs.neu.edu/download/attachments/14460575/$F.in
    sed -e "s/VERSION/$V/" $F.in > $F
    D=/usr/local/lib/pkgconfig 
    echo "./install.sh && mkdir -p $D && cp $F $D" > foo.sh
    chmod a+x foo.sh
    sudo checkinstall --fstrans=no --pkgname=openni-dev --pkgversion $V ./foo.sh
    F=/usr/local/lib/libOpenNI.so 
    sudo ln -s $F $F.0
    sudo ldconfig
    # to uninstall: sudo apt-get purge openni-dev; sudo rm /usr/local/lib/libOpenNI.so.0
    
    popd
    git clone https://github.com/PrimeSense/Sensor.git # gets 60170bfe (11/12/13) as of 11/13/13
    cd Sensor
    
    # fix hardcoded paths
    F=./Source/XnDeviceSensorV2/XnSensorClient.cpp 
    cp -n $F $F.ORIG
    sed -e 's|/usr|/usr/local|' $F.ORIG > $F
    F=./Platform/Linux/Build/EngineLibMakefile
    cp -n $F $F.ORIG
    sed -e 's|/usr|/usr/local|' $F.ORIG > $F
    F=./Platform/Linux/Build/Utils/EngineUtilMakefile
    cp -n $F $F.ORIG
    sed -e 's|/usr|/usr/local|' $F.ORIG > $F
    F=./Platform/Linux/Build/Common/CommonCppMakefile
    cp -n $F $F.ORIG
    sed -e '/LDFLAGS += $(LIB_DIRS_OPTION)/iLDFLAGS += -L/usr/local/lib' $F.ORIG > $F
    
    # fix install paths
    F=./Platform/Linux/CreateRedist/install.sh
    cp -n $F $F.ORIG
    sed -e '/INSTALL/s|usr|usr/local| ; s|/var/lib/ni|/usr/local/etc/openni| ; s|etc/primesense|etc/openni| ; s|/var/log|/usr/local/var/log|' $F.ORIG > $F
    
    # disable sse
    F=Platform/Linux/Build/Common/Platform.x86
    cp -n $F $F.ORIG
    sed -e 's/SSE_GENERATION = 3/SSE_GENERATION = 0/ ; s/DUMMY.*/DUMMY=/' $F.ORIG > $F
    
    # build
    cd Platform/Linux/CreateRedist
    sudo rm -rf ../Redist/*-Bin-*
    ./RedistMaker
    
    # install
    cd ../Redist
    D=`ls -d *-Bin*`
    V=`expr $D : ".*-v\(.*\)"`
    cd $D
    sudo checkinstall --fstrans=no --pkgname=ps-engine --pkgversion $V --exclude /usr/local/etc/openni/modules.xml ./install.sh
    sudo ldconfig
    # to uninstall: for f in `ls /usr/local/lib/libXnDevice*`; do sudo niReg -u $f; done; sudo apt-get purge ps-engine
    
    # niReg -l reports OpenNI 1.5.7.10/Sensor 5.1.6.6 (11/13/13)
    
    OpenNI Sample Applications: openni-dev and openni-utils come with some binary applications (dpkg-query -L openni-dev openni-utils | grep bin), with some documentation in the OpenNI User Guide. NiViewer has a lot of features to display and inspect the data (try hitting ? or right-clicking in NiViwer).
    Recording OpenNI Data: NiViewer can record live data (depth+rgb) to compressed .oni files, which can be read later in PCL (and also played back later by NiViewer). The required disk write bandwidth seems to be about 4MB/sec (the iotop utility is handy for monitoring this), however it seems the code does not include significant buffering and I did observe hiccups where roughly 1s of frames were dropped after about 30s of recording. The NiBackRecorder app does record to a memory buffer but is not designed for continuous streaming and does not have a live preview. PCL itself seems to include at least 6 ways to record OpenNI data to disk, see here for a rundown.
  6. Download, build, and install pcl-trunk from github
    sudo apt-get install git-gui cmake-gui doxygen checkinstall
    git clone https://github.com/PointCloudLibrary/pcl.git pcl-trunk # gets a504a690 (11/9/13) on 11/13/13
    cd pcl-trunk
    
    mkdir build && cd build
    cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_GPU=ON -DBUILD_apps=OFF -DBUILD_examples=OFF .. # see notes below
    make -j`nproc` # use as many parallel build processes as cpu cores, use make VERBOSE=1 ... for detailed messages
    sudo checkinstall --fstrans=no --pkgname=pcl-trunk
    sudo ldconfig
    # to list installed files: dpkg-query -L pcl-trunk
    # to uninstall: sudo apt-get remove pcl-trunk
    
    Notes:
    1. If you see "gpu_kinfu_large_scale: Requires surface" in "subsystems will not be built" the first time you run cmake then run the same cmake command line again. The second time gpu_kinfu_large_scale should be in the "will be built" category.
    2. Change BUILD_apps=ON and BUILD_examples=ON if you want those things built too. AFAIK they are not needed just to build the PCL libraries.
    3. Different OpenNI versions may not be fully ABI compatible with each other. So you may experience errors if you build PCL against one OpenNI version and then later link apps with a different OpenNI version. I am not sure, this may only apply to the OpenNI framework version, not the Sensor driver version.
    4. If you get link errors with code that links to PCL libraries, try removing the installed package and re-running the checkinstall. For some reason sometimes the required *.so files (with no version extension) don't get installed into /usr/local/lib.
  • No labels