Problem when compile CMakeLists
GraceJary opened this issue · 1 comments
GraceJary commented
CMakeFiles/cxx_3d_seg_pybind_executable.dir/cxx_3d_seg.cpp.o: In function `cxx_3d_seg::pose_estimation(cv::Mat&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, float)':
cxx_3d_seg.cpp:(.text+0x1b44): undefined reference to `IOManager::ReadObject(char const*, std::vector<GlobalRegistration::Point3D, std::allocator<GlobalRegistration::Point3D> >&, std::vector<Eigen::Matrix<float, 2, 2, 0, 2, 2>, std::allocator<Eigen::Matrix<float, 2, 2, 0, 2, 2> > >&, std::vector<Eigen::Matrix<float, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >&, std::vector<tripple, std::allocator<tripple> >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)'
cxx_3d_seg.cpp:(.text+0x1c82): undefined reference to `GlobalRegistration::MatchSuper4PCS::MatchSuper4PCS(GlobalRegistration::Match4PCSOptions const&, GlobalRegistration::Utils::Logger const&)'
cxx_3d_seg.cpp:(.text+0x1d04): undefined reference to `GlobalRegistration::MatchSuper4PCS::~MatchSuper4PCS()'
cxx_3d_seg.cpp:(.text+0x288f): undefined reference to `GlobalRegistration::MatchSuper4PCS::~MatchSuper4PCS()'
CMakeFiles/cxx_3d_seg_pybind_executable.dir/cxx_3d_seg.cpp.o: In function `void GlobalRegistration::Match4PCSBase::init<GlobalRegistration::Sampling::UniformDistSampler>(std::vector<GlobalRegistration::Point3D, std::allocator<GlobalRegistration::Point3D> > const&, std::vector<GlobalRegistration::Point3D, std::allocator<GlobalRegistration::Point3D> > const&, GlobalRegistration::Sampling::UniformDistSampler const&)':
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_[_ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_]+0xd16): undefined reference to `GlobalRegistration::Match4PCSBase::initKdTree()'
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_[_ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_]+0xde0): undefined reference to `GlobalRegistration::Match4PCSBase::MeanDistance()'
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_[_ZN18GlobalRegistration13Match4PCSBase4initINS_8Sampling18UniformDistSamplerEEEvRKSt6vectorINS_7Point3DESaIS5_EES9_RKT_]+0xf63): undefined reference to `GlobalRegistration::Match4PCSBase::Verify(Eigen::Ref<Eigen::Matrix<float, 4, 4, 0, 4, 4> const, 0, Eigen::OuterStride<-1> > const&) const'
CMakeFiles/cxx_3d_seg_pybind_executable.dir/cxx_3d_seg.cpp.o: In function `bool GlobalRegistration::Match4PCSBase::TryCongruentSet<GlobalRegistration::Match4PCSBase::DummyTransformVisitor>(int, int, int, int, std::vector<GlobalRegistration::Quadrilateral, std::allocator<GlobalRegistration::Quadrilateral> > const&, GlobalRegistration::Match4PCSBase::DummyTransformVisitor const&, unsigned long&)':
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase15TryCongruentSetINS0_21DummyTransformVisitorEEEbiiiiRKSt6vectorINS_13QuadrilateralESaIS4_EERKT_Rm[_ZN18GlobalRegistration13Match4PCSBase15TryCongruentSetINS0_21DummyTransformVisitorEEEbiiiiRKSt6vectorINS_13QuadrilateralESaIS4_EERKT_Rm]+0x6ca): undefined reference to `GlobalRegistration::Match4PCSBase::ComputeRigidTransformation(std::array<GlobalRegistration::Point3D, 4ul> const&, std::array<GlobalRegistration::Point3D, 4ul> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1>, float, Eigen::Ref<Eigen::Matrix<float, 4, 4, 0, 4, 4>, 0, Eigen::OuterStride<-1> >, float&, bool) const'
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase15TryCongruentSetINS0_21DummyTransformVisitorEEEbiiiiRKSt6vectorINS_13QuadrilateralESaIS4_EERKT_Rm[_ZN18GlobalRegistration13Match4PCSBase15TryCongruentSetINS0_21DummyTransformVisitorEEEbiiiiRKSt6vectorINS_13QuadrilateralESaIS4_EERKT_Rm]+0x72f): undefined reference to `GlobalRegistration::Match4PCSBase::Verify(Eigen::Ref<Eigen::Matrix<float, 4, 4, 0, 4, 4> const, 0, Eigen::OuterStride<-1> > const&) const'
CMakeFiles/cxx_3d_seg_pybind_executable.dir/cxx_3d_seg.cpp.o: In function `bool GlobalRegistration::Match4PCSBase::TryOneBase<GlobalRegistration::Match4PCSBase::DummyTransformVisitor>(GlobalRegistration::Match4PCSBase::DummyTransformVisitor const&)':
cxx_3d_seg.cpp:(.text._ZN18GlobalRegistration13Match4PCSBase10TryOneBaseINS0_21DummyTransformVisitorEEEbRKT_[_ZN18GlobalRegistration13Match4PCSBase10TryOneBaseINS0_21DummyTransformVisitorEEEbRKT_]+0x51): undefined reference to `GlobalRegistration::Match4PCSBase::SelectQuadrilateral(float&, float&, int&, int&, int&, int&)'
CMakeFiles/cxx_3d_seg_pybind_executable.dir/test.cpp.o: In function `super4pcs_test()':
test.cpp:(.text+0x897a): undefined reference to `IOManager::ReadObject(char const*, std::vector<GlobalRegistration::Point3D, std::allocator<GlobalRegistration::Point3D> >&, std::vector<Eigen::Matrix<float, 2, 2, 0, 2, 2>, std::allocator<Eigen::Matrix<float, 2, 2, 0, 2, 2> > >&, std::vector<Eigen::Matrix<float, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >&, std::vector<tripple, std::allocator<tripple> >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)'
test.cpp:(.text+0x8aba): undefined reference to `GlobalRegistration::MatchSuper4PCS::MatchSuper4PCS(GlobalRegistration::Match4PCSOptions const&, GlobalRegistration::Utils::Logger const&)'
test.cpp:(.text+0x8b32): undefined reference to `GlobalRegistration::MatchSuper4PCS::~MatchSuper4PCS()'
test.cpp:(.text+0x924b): undefined reference to `GlobalRegistration::MatchSuper4PCS::~MatchSuper4PCS()'
collect2: error: ld returned 1 exit status
CMakeFiles/cxx_3d_seg_pybind_executable.dir/build.make:321: recipe for target 'cxx_3d_seg_pybind_executable' failed
make[2]: *** [cxx_3d_seg_pybind_executable] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cxx_3d_seg_pybind_executable.dir/all' failed
make[1]: *** [CMakeFiles/cxx_3d_seg_pybind_executable.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
meiqua commented
"undefined reference" often means some libraries are not preperly linked.
Have you ever compiled super4pcs with -fPIC flag? (-fPIC: Position Independent Code)
Like this:
mkdir build
cd build
cmake .. -DCMAKE_CXX_FLAGS="-fpic"
make
sudo make install