Skip to content

undefined reference error in compiling #458

Open
@X-Bruce-Y

Description

@X-Bruce-Y

Dear developers,

I want to thank you for creating this comprehensive point cloud toolkit, and some of the filters are exactly what I need now. I'm literally new to C++ language and not very familiar with Linux, so it took me ~20 hrs to set up eigen, boost and libnabo and "successfully" make install libpointmatcher through trials and errors. However, when I try compiling examples/demo_cmake/convert.cpp, the following error messages were thrown:

/tmp/ccokO4LU.o: In function `main':
convert.cpp:(.text+0x163): undefined reference to `PointMatcher<float>::get()'
convert.cpp:(.text+0x202): undefined reference to `PointMatcherSupport::setLogger(std::shared_ptr<PointMatcherSupport::Logger>)'
convert.cpp:(.text+0x28d): undefined reference to `PointMatcher<float>::DataPoints::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
convert.cpp:(.text+0x360): undefined reference to `PointMatcher<float>::DataPointsFilters::DataPointsFilters(std::istream&)'
convert.cpp:(.text+0x379): undefined reference to `PointMatcher<float>::DataPointsFilters::apply(PointMatcher<float>::DataPoints&)'
convert.cpp:(.text+0x3fa): undefined reference to `PointMatcher<float>::DataPoints::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/tmp/ccokO4LU.o: In function `PointMatcherSupport::Registrar<PointMatcherSupport::Logger>::getDescriptor(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
convert.cpp:(.text._ZNK19PointMatcherSupport9RegistrarINS_6LoggerEE13getDescriptorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK19PointMatcherSupport9RegistrarINS_6LoggerEE13getDescriptorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x11c): undefined reference to `PointMatcherSupport::InvalidElement::InvalidElement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status

Which I don't even know how to debug and almost destroyed my will to make use of libpointmatcher as I have spend too much time on merely setting it up. So I'm giving myself a last chance to open an issue here, hoping to get some guidance.

Related environment is:

boost 1.70.0 (non-conda)
eigen 3.3.9
libnabo 1.07
g++ 9.3.0 and gcc 9.3.0 (non-conda)
cmake 3.18.4 (conda)
make 3.82
system (on HPC cluster with slurm) 
    LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
    Distributor ID:	CentOS
    Description:	CentOS Linux release 7.6.1810 (Core) 
    Release:	7.6.1810
    Codename:	Core

I have put boost, eigen, libnabo and libpointmatcher into CPATH.

What I have tried:

  1. The head part of examples/demo_cmake/convert.cpp can be compiled successfully.

     #include "pointmatcher/PointMatcher.h"
     #include <cassert>
     #include <iostream>
     #include <fstream>
     
     using namespace std;
     using namespace PointMatcherSupport;
     
     typedef PointMatcher<float> PM;
     typedef PM::DataPoints DP;
    

while any more than that would cause error message.

  1. Compiling libnabo/examples/usage.cpp throws the following error:

     /tmp/cc1taue8.o: In function `main':
     usage.cpp:(.text+0x94): undefined reference to `Nabo::NearestNeighbourSearch<float, Eigen::Matrix<float, -1, -1, 0, -1, -1> >::createKDTreeLinearHeap(Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, int, unsigned int, Nabo::Parameters const&)'
     collect2: error: ld returned 1 exit status
    

Compiling libnabo/examples/trivial.cpp throws the following error:

    /tmp/ccXKCvIU.o: In function `main':
    trivial.cpp:(.text+0x89): undefined reference to `Nabo::NearestNeighbourSearch<float, Eigen::Matrix<float, -1, -1, 0, -1, -1> >::createKDTreeLinearHeap(Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, int, unsigned int, Nabo::Parameters const&)'
    trivial.cpp:(.text+0x10e): undefined reference to `Nabo::NearestNeighbourSearch<float, Eigen::Matrix<float, -1, -1, 0, -1, -1> >::knn(Eigen::Matrix<float, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&, Eigen::Matrix<float, -1, 1, 0, -1, 1>&, int, float, unsigned int, float) const'
    collect2: error: ld returned 1 exit status

Please allow me to put it here as that might be the cause of libpointmatcher failure and the repo of libnabo is short of maintenance.

  1. Changing boost 1.70.0 to 1.74.0 or 1.75.0 would cause some "undefined reference" error during making libpointmatcher, let alone to say using it.

Please forgive my possible informality in describing the situation. If any other information should be required, please just ask and I'll add it as long as I'm able to.

Bests.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions