I am having the strangest linking error when trying to run the example provided by pcl:
http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php
I have narrowed the error down to the following line:
ec.extract (cluster_indices);
When i remove this line there are no linking errors otherwise i get a bunch that look like this:
/usr/local/lib/libpcl_search.a(organized.cpp.o): In function `pcl::search::OrganizedNeighbor<pcl::PointXYZL>::computeCameraMatrix(Eigen::Matrix<float, 3, 3, 0, 3, 3>&) const':
organized.cpp:(.text._ZNK3pcl6search17OrganizedNeighborINS_9PointXYZLEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
[_ZNK3pcl6search17OrganizedNeighborINS_9PointXYZLEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE]+0xc):
undefined reference to `pcl::getCameraMatrixFromProjectionMatrix(Eigen::Matrix<float, 3, 4, 1, 3, 4> const&, Eigen::Matrix<float, 3, 3, 0, 3, 3>&)'
ec
is of the type pcl::EuclideanClusterExtraction<pcl::PointXYZ>
and all of the ascociated point clouds are also use the pcl::PointXYZ
template. This is all directly out of the example.
I have had a very similar error before and it turned out to be because I was attempting to use the pcl::PointXY
with the SampleConsesus
library which is not supported.
To attempt to solve this problem I used nm
on the libpcl_search.a
link library and the values included look like this:
_ZNK3pcl6search17OrganizedNeighborINS_11PointNormalEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
which are close to the include funcitons needed, but it seems like the PointXYZ
implementation doesn't exist? How can i find out if this is the case and why?
SO it looks like cmake is struggling with the dependencies. The reason I am sure is because of the way we are forced to include pcl. We are using an operating system called QNX
which means that the CMakeLists.txt
needs to look like this:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set (CMAKE_C_COMPILER /usr/qnx650/host/qnx6/x86/usr/bin/gcc)
set (CMAKE_CXX_COMPILER /usr/qnx650/host/qnx6/x86/usr/bin/g++)
project(cluster_extraction)
find_package(PCL 1.7 REQUIRED)
include_directories(/usr/local/include /usr/local/include/pcl-1.7)
link_directories(/usr/local/lib)
add_definitions(${PCL_DEFINITIONS})
add_executable (cluster_extraction testEuclideanclustering.cpp)
target_link_libraries (cluster_extraction ${PCL_LIBRARIES})
If I add the direct link to pcl_search
after the link of ${PCL_LIBRARIES}
then it will compile. It seems like we need to make our own cmake
rules for pcl
.