PointCloudLibrary/pcl

Link error: cannot find vtkproj4

jacquelinekay opened this issue · 5 comments

Greetings,

We are trying to get the pcl/ros packages building in Xenial for the upcoming ROS Kinetic release.

We discovered some link errors building the existing code in Xenial using the libpcl1.7 binary: ros-perception/perception_pcl#119

/usr/bin/ld: cannot find -lvtkproj4

I reproduced the errors with a minimal CMake-only example (no dependencies besides pcl 1.7).

Source: https://gist.github.com/jacquelinekay/de36ff4a398793913e7e96064c893e1b
CMakeLists.txt: https://gist.github.com/jacquelinekay/3158868ccdb044920b31acfdb065b6b6

It appears that when PCLConfig.cmake is generated, the find_vtk function sets VTK_LIBRARIES to a hardcoded list of libraries that includes lvtkproj4, which doesn't exist:
https://github.com/PointCloudLibrary/pcl/blob/master/PCLConfig.cmake.in#L468-Lundefined

(As a side note, there is also a problem where vtk6 cannot locate libproj.so. I needed to manually install libproj-dev to pull in the dynamic library name that vtk was expecting. I will ticket this separately for VTK.)

HI Jackie,

that's a bug in vtk6: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819741. You can ask the Ubuntu maintainers to import the new version from Debian unstable.

Cheers Jochen

Hi,
as mention above by @hobu I encountered this /usr/bin/ld: cannot find -lvtkproj4 error several times while compiling PDAL with PCL support.

I installed PCL libraries from the official Xenial repositories.

The "macro(find_vtk)" in the file /usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake is slightly different from the one mentioned by @jacquelinekay.
Here is this macro part in mine : http://pastebin.com/raw/r5JV02tL (I have separated the lib names by new lines for more readability).

I'm using Ubuntu 16.04 kernel 4.4.0-28-generic.

Is there something I can do to fix this ?
Thanks.

hobu commented

For those trying to get PDAL to work, this is dirty hackery, but it should allow things to link without being too disruptive (no touching cmake configs)

ln -s /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so /usr/lib/libvtkproj4.so

To fix the following error when execute cmake in Ubuntu 16.04:

-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:

Install python-vtk6 and create a link:

ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so

If you're working with ROS the symlink that worked for me is below! thanks to @fernandojunior for the initial pointer.

ln -s /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so /usr/lib/x86_64-linux-gnu/libvtkproj4-6.2.so.6.2.0