PCL 1.7 throws undefined_reference exceptions when I define my own type of point cloud.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PCL 1.7 throws undefined_reference exceptions when I define my own type of point cloud.

rojas70

Dear all, trying to get some help on an undefined refernence problem.
I am trying to run an open source code, with a github repo here:
https://github.com/hemakoppula/human_activity_anticipation/tree/master/src

CMakeLists.txt

Originally, the code was produced using PCL_1.6, currently I am trying to use v. 1.7. The CMakeLists.txt file reflects this:

find_package(PCL 1.7 REQUIRED COMPONENTS common io search)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

Undefined References

Getting a series of undefined references with what I think is an unrecognized typedef, namely: pcl::PointXYZRGBCamSL.

For example, when running cmake.. and then make using v. 1.7. I get these errors:

>>$ grep pcl::PointXYZRGBCamSL compile.out 
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `getClusters(pcl::PointCloud<pcl::PointXYZRGBCamSL>&, std::vector<pcl::PointCloud<pcl::PointXYZRGB>, std::allocator<pcl::PointCloud<pcl::PointXYZRGB> > >&, std::vector<pcl::PointIndices, std::allocator<pcl::PointIndices> >&, bool)':
featureGenerationForFramesSampled.cpp:(.text+0x2602): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
featureGenerationForFramesSampled.cpp:(.text+0x26e9): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::Feature<pcl::PointXYZRGBCamSL, pcl::Normal>::Feature()':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEEC2Ev[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEEC5Ev]+0x15): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBCamSL>::PCLBase()'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::Feature<pcl::PointXYZRGBCamSL, pcl::Normal>::initCompute()':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv]+0x20): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBCamSL>::initCompute()'
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv]+0x1b8): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::search::OrganizedNeighbor<pcl::PointXYZRGBCamSL>::OrganizedNeighbor(bool, float, unsigned int)':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_16PointXYZRGBCamSLEEC2Ebfj[_ZN3pcl6search17OrganizedNeighborINS_16PointXYZRGBCamSLEEC5Ebfj]+0x50): undefined reference to `pcl::search::Search<pcl::PointXYZRGBCamSL>::Search(std::string const&, bool)'

The structore of the code is as follows:
src:

  • .cpp (uses typedef, has @include .h files)
  • pointClustering.h // includes the typedefed
    includes:
  • point_types.h // includes the namespaced new type (i.e. pcl::PointXYZRGBCamSL)

PCL 1.6 and PCL 1.7 API shoudl have no conflict

I checked the api and the methods are exactly the same. So, that leads me to believe that all the errors have to do with the fact that we are using a specific type:
pcl::PointXYZRGBCamSL

pcl::PointXYZRGBCamSL is defined in src/includes/point_types.h

    struct PointXYZRGBCamSL
    {
        PCL_ADD_POINT4D;
         union
          {
            struct
            {
                  float rgb;
            };
            float data_c[4];
          };
        uint32_t cameraIndex;
        float distance;
        uint32_t segment;
        uint32_t label;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
    } EIGEN_ALIGN16;
}

That type is then typedef’d in src/pointClustering.h
My main .cpp includes another file called frame.cpp, frame.cpp include pointClustering.h.

typedef pcl::PointXYZRGBCamSL PointOutT;

If you look back at the undefined reference errors, for example this one:

`pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'

It seems it’s not the KdTree definition that is the problem, but the type:
http://docs.pointclouds.org/1.7.0/classpcl_1_1search_1_1_kd_tree.html#a70e9612857ee78a62c1b14c7f05a8945

Any advice on why this might be is appreciated.
Sincerely.


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PCL 1.7 throws undefined_reference exceptions when I define my own type of point cloud.

Sérgio Agostinho
PointXYZRGBCamSL is a custom point type. Have a look at this and make sure you read about the registration mechanism. Ensure that everything mentioned in that tutorial is respectd.

The second thing is that since your type is custom, none of the algorithms were precompiled with it. Define PCL_NO_PRECOMPILE before including pcl headers. Report results.


Cheers
Sérgio


2018-01-03 15:16 GMT+00:00 Juan Rojas <[hidden email]>:

Dear all, trying to get some help on an undefined refernence problem.
I am trying to run an open source code, with a github repo here:
https://github.com/hemakoppula/human_activity_anticipation/tree/master/src

CMakeLists.txt

Originally, the code was produced using PCL_1.6, currently I am trying to use v. 1.7. The CMakeLists.txt file reflects this:

find_package(PCL 1.7 REQUIRED COMPONENTS common io search)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

Undefined References

Getting a series of undefined references with what I think is an unrecognized typedef, namely: pcl::PointXYZRGBCamSL.

For example, when running cmake.. and then make using v. 1.7. I get these errors:

>>$ grep pcl::PointXYZRGBCamSL compile.out 
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `getClusters(pcl::PointCloud<pcl::PointXYZRGBCamSL>&, std::vector<pcl::PointCloud<pcl::PointXYZRGB>, std::allocator<pcl::PointCloud<pcl::PointXYZRGB> > >&, std::vector<pcl::PointIndices, std::allocator<pcl::PointIndices> >&, bool)':
featureGenerationForFramesSampled.cpp:(.text+0x2602): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
featureGenerationForFramesSampled.cpp:(.text+0x26e9): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::Feature<pcl::PointXYZRGBCamSL, pcl::Normal>::Feature()':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEEC2Ev[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEEC5Ev]+0x15): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBCamSL>::PCLBase()'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::Feature<pcl::PointXYZRGBCamSL, pcl::Normal>::initCompute()':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv]+0x20): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBCamSL>::initCompute()'
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv[_ZN3pcl7FeatureINS_16PointXYZRGBCamSLENS_6NormalEE11initComputeEv]+0x1b8): undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'
CMakeFiles/frameFeats.dir/src/featureGenerationForFramesSampled.cpp.o: In function `pcl::search::OrganizedNeighbor<pcl::PointXYZRGBCamSL>::OrganizedNeighbor(bool, float, unsigned int)':
featureGenerationForFramesSampled.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_16PointXYZRGBCamSLEEC2Ebfj[_ZN3pcl6search17OrganizedNeighborINS_16PointXYZRGBCamSLEEC5Ebfj]+0x50): undefined reference to `pcl::search::Search<pcl::PointXYZRGBCamSL>::Search(std::string const&, bool)'

The structore of the code is as follows:
src:

  • .cpp (uses typedef, has @include .h files)
  • pointClustering.h // includes the typedefed
    includes:
  • point_types.h // includes the namespaced new type (i.e. pcl::PointXYZRGBCamSL)

PCL 1.6 and PCL 1.7 API shoudl have no conflict

I checked the api and the methods are exactly the same. So, that leads me to believe that all the errors have to do with the fact that we are using a specific type:
pcl::PointXYZRGBCamSL

pcl::PointXYZRGBCamSL is defined in src/includes/point_types.h

    struct PointXYZRGBCamSL
    {
        PCL_ADD_POINT4D;
         union
          {
            struct
            {
                  float rgb;
            };
            float data_c[4];
          };
        uint32_t cameraIndex;
        float distance;
        uint32_t segment;
        uint32_t label;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
    } EIGEN_ALIGN16;
}

That type is then typedef’d in src/pointClustering.h
My main .cpp includes another file called frame.cpp, frame.cpp include pointClustering.h.

typedef pcl::PointXYZRGBCamSL PointOutT;

If you look back at the undefined reference errors, for example this one:

`pcl::search::KdTree<pcl::PointXYZRGBCamSL>::KdTree(bool)'

It seems it’s not the KdTree definition that is the problem, but the type:
http://docs.pointclouds.org/1.7.0/classpcl_1_1search_1_1_kd_tree.html#a70e9612857ee78a62c1b14c7f05a8945

Any advice on why this might be is appreciated.
Sincerely.


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users