Compiling PCL 1.7 on Ubuntu 16.04 , errors in CMake generated Makefile

Brandon Powers picture Brandon Powers · May 22, 2016 · Viewed 14.8k times · Source

I'm trying to get PCL 1.7 (The point cloud library, not the other pcl) working on Ubuntu 16.04. I eventually hope to use for C++ stuff, but right now I'm just trying to get the examples working. I'm using the default compilers that came with Ubuntu (GNU 5.3.1), and Cmake version 3.5.2. I've been following the directions on PCL's website (here and here), but am currently stuck at the point where I use the 'make' command after letting Cmake build the things it wants to build. This is the error I get

[ 50%] Building CXX object CMakeFiles/pcd_write.dir/pcd_write.cpp.o
<command-line>:0:15: warning: missing whitespace after the macro name
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libproj.so', needed by 'pcd_write'.  Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pcd_write.dir/all' failed
make[1]: *** [CMakeFiles/pcd_write.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Cmake also gives me warnings when I'm building things, and those are here. They don't stop it from running, but they might be relevant.

-- Found OpenNI2: /usr/lib/libOpenNI2.so  
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   " /usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
    but not all the files it references.

Also, in case it's relevant, I did a potentially stupid thing earlier when it was giving me similar warnings about VTK. It was telling me that /user/bin/vtk was renamed or something, and it was. This version of VTK called itself vtk6. I tried to root around in the makefiles to find that and change it so Cmake would know to look for vtk6, but I couldn't find it anywhere, so I went into the bin and made a copy of vtk6 named vtk, and it stopped giving me a warning.

Other relevant versions of stuff I'm using are eigen3 3.2.92, boost 1.58.0, flan 1.8.4, vtk6, and libopenni2 version 2.2.0.3

Again, not sure how much of this is actually important, but better to be too specific than too vague IMO.

Answer

mesilliac picture mesilliac · Oct 14, 2016

This bug is still in 16.04, but there is a workaround.

  1. sudo apt install libproj-dev

  2. add the following line to your CMakeLists.txt file:
    list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")

The first provides the necessary libproj.so, and the second fixes errors when linking against a nonexistent (and unnecessary) libvtkproj4.

The other errors about referenced files not existing appear to be harmless (or at least my project compiles despite having the same errors).

for more information, see:
https://bugs.launchpad.net/ubuntu/+source/pcl/+bug/1573174
https://bugs.launchpad.net/ubuntu/+source/vtk6/+bug/1573234