mardi 21 juin 2016

Linker error with VTK when linking Point Cloud Library project on MacOS El Capitan

I have been trying to compile this PCL tutorial with little success so far because of a linker error involving a component of the VTK library.

I'm using a MacBook running El Capitan. I struggled quite a bit until I was able to install PCL 1.7 and its dependencies using homebrew from homebrew science.

The file structure in my working directory is quite simple:

  • alignment_prerejective.cpp plus two external data files
  • CMakeLists.txt (same as in the tutorial linked above)

The output of cmake . is posted below. From what I can see, things go well except for the OpenNI library.

-- The C compiler identification is AppleClang 7.0.2.7000181
-- The CXX compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler:            /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler:     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking for module 'eigen3'
--   Found eigen3, version 3.1.1
-- Found eigen: /opt/local/include/eigen3  
-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   serialization
--   chrono
-- Checking for module 'openni-dev'
--   Package 'openni-dev' not found
-- Could NOT find openni (missing:  OPENNI_INCLUDE_DIRS) 
** WARNING ** io features related to openni will be disabled
-- Checking for module 'openni2-dev'
--   Package 'openni2-dev' not found
-- Could NOT find OpenNI2 (missing:  OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS) 
** WARNING ** io features related to openni2 will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- Found libusb-1.0: /opt/local/include  
-- Checking for module 'flann'
--   Found flann, version 1.7.1
-- Found Flann: /opt/local/lib/libflann_cpp_s.a  
-- Checking for module 'openni-dev'
--   Package 'openni-dev' not found
-- Could NOT find openni (missing:  OPENNI_INCLUDE_DIRS) 
** WARNING ** visualization features related to openni will be disabled
-- Checking for module 'openni2-dev'
--   Package 'openni2-dev' not found
-- Could NOT find OpenNI2 (missing:  OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS) 
** WARNING ** visualization features related to openni2 will be disabled
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/local/lib/libpcl_common.dylib  
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/local/lib/libpcl_octree.dylib  
-- looking for PCL_IO
-- Found PCL_IO: /usr/local/lib/libpcl_io.dylib  
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/local/lib/libpcl_kdtree.dylib  
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/local/lib/libpcl_search.dylib  
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/libpcl_sample_consensus.dylib  
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/local/lib/libpcl_filters.dylib  
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/local/lib/libpcl_features.dylib  
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/local/lib/libpcl_registration.dylib  
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/local/include/pcl-1.7  
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/local/lib/libpcl_segmentation.dylib  
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/local/lib/libpcl_visualization.dylib  
-- Found PCL: /usr/local/lib/libboost_system-mt.dylib;/usr/local/lib/libboost_filesystem-mt.dylib;/usr/local/lib/libboost_thread-mt.dylib;/usr/local/lib/libboost_date_time-mt.dylib;/usr/local/lib/libboost_iostreams-mt.dylib;/usr/local/lib/libboost_serialization-mt.dylib;/usr/local/lib/libboost_chrono-mt.dylib;optimized;/usr/local/lib/libpcl_common.dylib;debug;/usr/local/lib/libpcl_common.dylib;optimized;/usr/local/lib/libpcl_octree.dylib;debug;/usr/local/lib/libpcl_octree.dylib;vtkalglib;vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;/usr/lib/libz.dylib;vtkftgl;vtkDICOMParser;vtkDomainsChemistry;vtkIOXML;vtkIOGeometry;vtkIOCore;vtkIOXMLParser;/usr/lib/libexpat.dylib;vtkexoIIc;vtkNetCDF;vtkNetCDF_cxx;/usr/local/lib/libhdf5.dylib;/usr/local/lib/libsz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib;/usr/local/lib/libhdf5_hl.dylib;vtkFiltersAMR;vtkParallelCore;vtkIOLegacy;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkFiltersHybrid;vtkImagingSources;vtkFiltersHyperTree;vtkFiltersImaging;vtkImagingGeneral;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersProgrammable;vtkFiltersPython;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib;vtkWrappingPythonCore;vtkWrappingTools;vtkFiltersSelection;vtkFiltersSMP;vtkFiltersTexture;vtkFiltersVerdict;verdict;vtkGeovisCore;vtkInfovisLayout;vtkImagingHybrid;vtkIOImage;vtkmetaio;/usr/local/lib/libjpeg.dylib;/usr/local/lib/libpng.dylib;/usr/local/lib/libtiff.dylib;vtkInteractionStyle;vtkInteractionWidgets;vtkRenderingAnnotation;vtkImagingColor;vtkRenderingVolume;vtkViewsCore;vtkproj4;vtkgl2ps;vtkGUISupportQt;vtkRenderingOpenGL;vtkGUISupportQtOpenGL;vtkGUISupportQtSQL;vtkIOSQL;vtksqlite;vtkGUISupportQtWebkit;vtkViewsQt;vtkViewsInfovis;vtkRenderingLabel;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInfovisBoostGraphAlgorithms;vtkInteractionImage;vtkIOAMR;vtkIOEnSight;vtkIOExodus;vtkIOExport;vtkRenderingGL2PS;vtkRenderingContextOpenGL;vtkIOImport;vtkIOInfovis;/usr/lib/libxml2.dylib;vtkIOLSDyna;vtkIOMINC;vtkIOMovie;vtkoggtheora;vtkIONetCDF;vtkIOParallel;vtkjsoncpp;vtkIOParallelXML;vtkIOPLY;vtkIOVideo;vtkRenderingFreeTypeFontConfig;vtkRenderingImage;vtkRenderingLIC;vtkRenderingLOD;vtkRenderingQt;vtkRenderingVolumeOpenGL;vtkViewsContext2D;optimized;/usr/local/lib/libpcl_io.dylib;debug;/usr/local/lib/libpcl_io.dylib;optimized;/opt/local/lib/libflann_cpp_s.a;debug;/opt/local/lib/libflann_cpp_s-gd.a;optimized;/usr/local/lib/libpcl_kdtree.dylib;debug;/usr/local/lib/libpcl_kdtree.dylib;optimized;/usr/local/lib/libpcl_search.dylib;debug;/usr/local/lib/libpcl_search.dylib;optimized;/usr/local/lib/libpcl_sample_consensus.dylib;debug;/usr/local/lib/libpcl_sample_consensus.dylib;optimized;/usr/local/lib/libpcl_filters.dylib;debug;/usr/local/lib/libpcl_filters.dylib;optimized;/usr/local/lib/libpcl_features.dylib;debug;/usr/local/lib/libpcl_features.dylib;optimized;/usr/local/lib/libpcl_registration.dylib;debug;/usr/local/lib/libpcl_registration.dylib;optimized;/usr/local/lib/libpcl_segmentation.dylib;debug;/usr/local/lib/libpcl_segmentation.dylib;optimized;/usr/local/lib/libpcl_visualization.dylib;debug;/usr/local/lib/libpcl_visualization.dylib;/usr/local/lib/libboost_system-mt.dylib;/usr/local/lib/libboost_filesystem-mt.dylib;/usr/local/lib/libboost_thread-mt.dylib;/usr/local/lib/libboost_date_time-mt.dylib;/usr/local/lib/libboost_iostreams-mt.dylib;/usr/local/lib/libboost_serialization-mt.dylib;/usr/local/lib/libboost_chrono-mt.dylib;optimized;/opt/local/lib/libflann_cpp_s.a;debug;/opt/local/lib/libflann_cpp_s-gd.a;vtkalglib;vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;/usr/lib/libz.dylib;vtkftgl;vtkDICOMParser;vtkDomainsChemistry;vtkIOXML;vtkIOGeometry;vtkIOCore;vtkIOXMLParser;/usr/lib/libexpat.dylib;vtkexoIIc;vtkNetCDF;vtkNetCDF_cxx;/usr/local/lib/libhdf5.dylib;/usr/local/lib/libsz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib;/usr/local/lib/libhdf5_hl.dylib;vtkFiltersAMR;vtkParallelCore;vtkIOLegacy;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkFiltersHybrid;vtkImagingSources;vtkFiltersHyperTree;vtkFiltersImaging;vtkImagingGeneral;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersProgrammable;vtkFiltersPython;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib;vtkWrappingPythonCore;vtkWrappingTools;vtkFiltersSelection;vtkFiltersSMP;vtkFiltersTexture;vtkFiltersVerdict;verdict;vtkGeovisCore;vtkInfovisLayout;vtkImagingHybrid;vtkIOImage;vtkmetaio;/usr/local/lib/libjpeg.dylib;/usr/local/lib/libpng.dylib;/usr/local/lib/libtiff.dylib;vtkInteractionStyle;vtkInteractionWidgets;vtkRenderingAnnotation;vtkImagingColor;vtkRenderingVolume;vtkViewsCore;vtkproj4;vtkgl2ps;vtkGUISupportQt;vtkRenderingOpenGL;vtkGUISupportQtOpenGL;vtkGUISupportQtSQL;vtkIOSQL;vtksqlite;vtkGUISupportQtWebkit;vtkViewsQt;vtkViewsInfovis;vtkRenderingLabel;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInfovisBoostGraphAlgorithms;vtkInteractionImage;vtkIOAMR;vtkIOEnSight;vtkIOExodus;vtkIOExport;vtkRenderingGL2PS;vtkRenderingContextOpenGL;vtkIOImport;vtkIOInfovis;/usr/lib/libxml2.dylib;vtkIOLSDyna;vtkIOMINC;vtkIOMovie;vtkoggtheora;vtkIONetCDF;vtkIOParallel;vtkjsoncpp;vtkIOParallelXML;vtkIOPLY;vtkIOVideo;vtkRenderingFreeTypeFontConfig;vtkRenderingImage;vtkRenderingLIC;vtkRenderingLOD;vtkRenderingQt;vtkRenderingVolumeOpenGL;vtkViewsContext2D (Required is at least version "1.7") 
-- Configuring done
-- Generating done

The error occurs when the linker is called:

Scanning dependencies of target alignment_prerejective
[ 50%] Building CXX object CMakeFiles/alignment_prerejective.dir/alignment_prerejective.cpp.o
[100%] Linking CXX executable alignment_prerejective
ld: library not found for -lvtkChartsCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [alignment_prerejective] Error 1
make[1]: *** [CMakeFiles/alignment_prerejective.dir/all] Error 2
make: *** [all] Error 2

What puzzles me is that it looks like vtkChartsCore was found by Cmake (see the line starting with Found PCL in the pasted Cmake output log). My guess is that this interpretation is actually incorrect, but I have no idea where to start and which files the linker actually needs, not to mention how to pass them to the linker.

Thanks!

ps: output of find / -name "*vtkChartsCore*"

/usr/local/Cellar/vtk/7.0.0/include/vtk-7.0/vtkChartsCoreModule.h
/usr/local/Cellar/vtk/7.0.0/lib/cmake/vtk-7.0/Modules/vtkChartsCore.cmake
/usr/local/Cellar/vtk/7.0.0/lib/cmake/vtk-7.0/Modules/vtkChartsCoreHierarchy.txt
/usr/local/Cellar/vtk/7.0.0/lib/libvtkChartsCore-7.0.1.dylib
/usr/local/Cellar/vtk/7.0.0/lib/libvtkChartsCore-7.0.dylib
/usr/local/Cellar/vtk/7.0.0/lib/libvtkChartsCorePython27D-7.0.1.dylib
/usr/local/Cellar/vtk/7.0.0/lib/libvtkChartsCorePython27D-7.0.dylib
/usr/local/Cellar/vtk/7.0.0/lib/python2.7/site-packages/vtk/vtkChartsCore.py
/usr/local/Cellar/vtk/7.0.0/lib/python2.7/site-packages/vtk/vtkChartsCore.pyc
/usr/local/Cellar/vtk/7.0.0/lib/python2.7/site-packages/vtk/vtkChartsCorePython.so
/usr/local/lib/libvtkChartsCore-7.0.1.dylib
/usr/local/lib/libvtkChartsCore-7.0.dylib
/usr/local/lib/libvtkChartsCorePython27D-7.0.1.dylib
/usr/local/lib/libvtkChartsCorePython27D-7.0.dylib
/usr/local/lib/python2.7/site-packages/vtk/vtkChartsCore.py
/usr/local/lib/python2.7/site-packages/vtk/vtkChartsCorePython.so

Aucun commentaire:

Enregistrer un commentaire