Reputation: 23
I'm getting some confusing linking errors in my project after a fresh compilation and install of PCL 1.8.0. Some classes are fine (I can read and render a PC) but as soon as I instantiate some others, I get a whack of linker errors.
eg.
#include <pcl/point_types.h>
#include <pcl/filters/statistical_outlier_removal.h>
int main()
{
pcl::StatisticalOutlierRemoval<pcl::PointXYZ> testObject;
}
Fails at linking with about 700 undefined references from within the PCL libraries. In this example most are related to FLANN related classes from libpcl_search.a and libpcl_recognition.a
/usr/local/lib/libpcl_search.a(kdtree.cpp.o):-1: In function `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::setSortedResults(bool)':
/home/Horatio/libs/pcl-pcl-1.8.0/search/include/pcl/search/impl/kdtree.hpp:65: error: undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setSortedResults(bool)'
CMake output messages seem to indicate that it is finding flann and I didn't have any issues compiling either library. I also tried explicitly calling find_package(flann) in my Cmake with no success.
Checking for module 'flann'
Found flann, version 1.8.4
I also built and ran the PCL unit tests related to the filter class in the example without error.
The only thing I can think that might be relevant is that I built PCl with shared_libs=OFF, and the flann libraries selected by cmake were still shared objects (*.so) despite there being *.a static libraries installed. I couldn't get cmake to properly identify them.
Do I explicitly need to link the shared dependencies of static libraries within a new project? I thought the point of static linking was (in part) to reduce the number of shared dependencies and increase portability?
Any specific help or directions to generally relevant info would be much appreciated!
Upvotes: 2
Views: 1758
Reputation: 361
I have solved simialr problem when I was using PCL Normal Computation by including below files from pcl/<module>/impl
#include <pcl/search/impl/kdtree.hpp>
#include <pcl/kdtree/impl/kdtree_flann.hpp>
Hope this helps.
Upvotes: 3