engcang / FAST-LIO-SAM-SC-QN

A SLAM implementation combining FAST-LIO2 with pose graph optimization and loop closing based on ScanContext, Quatro, and Nano-GICP
Other
76 stars 5 forks source link

undefined reference to `nanoflann::KdTreeFLANN<pcl::PointXYZI>::KdTreeFLANN(nanoflann::KdTreeFLANN<pcl::PointXYZI> const&) #1

Open ubicray opened 6 months ago

ubicray commented 6 months ago

Hey! First of all, great work! I've been looking for a replacement for FAST_LIO_SAM, wanted to give this one a try I keep getting this error when trying to build tho:

ros1_ws/install/nano_gicp/lib/libnanoflann.so: undefined reference to `nanoflann::KdTreeFLANN::KdTreeFLANN(nanoflann::KdTreeFLANN const&)' clang++: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [CMakeFiles/fast_lio_sam_sc_qn_node.dir/build.make:324: devel/lib/fast_lio_sam_sc_qn/fast_lio_sam_sc_qn_node] Error 1 make[1]: [CMakeFiles/Makefile2:2759: CMakeFiles/fast_lio_sam_sc_qn_node.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

I believe it's because there are 2 distinct libs named nanoflann included I would like to not have to build packages in separate steps How would I go about achieving that? Or would you recommend going for the SC-less version?

engcang commented 6 months ago

@ubicray Hi. You are right. I did not recognize there are two files with same names. I think it should be solved with the new commit. Please pull the latest code and tell me if it works

ubicray commented 6 months ago

@engcang thanks for the fast response! Now the compiler complains about a lot of redefinitions between the nanoflann headers. The nanoflann_impl.hpp and nanoflann header of scancontext are very similar with only a few lines of difference between them. Maybe 1 of them can be taken out and the other one used? What do you think?

engcang commented 6 months ago

@ubicray Yeah you are right. So I just rolled back it to the former version. Please try with catkin build instead of catkin_make I am using Ubuntu 20.04 and ROS noetic. I cannot reproduce the error you reported at first. Can you specify your environments?

ubicray commented 6 months ago

@engcang I need to use colcon as I have ROS2 in the pipeline too and would like to be able to use the same tooling. I can manage the changes due to using install space and make a PR here if you'd like me to, it'd be necessary for your work to behave well in production-like systems. Would still need your help regarding all the redefinitions. Do these files need to be so different? I do remember using Scancontext and nanogicp together on some other project that didn't have such clashes

engcang commented 6 months ago

@ubicray As you can check, I put the Scancontext and Nanogicp as submodules without changing the original author's files. If possible, I want to keep them unchanged, as they are not my works and hence imported as submodules. Can you show me the other project that uses Scancontext and Nanogicp together?

ubicray commented 6 months ago

@engcang my apologies, thought faster_lio_sam had it. Okay, understand why you'd want them untouched. To your knowledge, if I were to take nanoflann header out of scancontext and use the one that comes with nanogicp, should it work? I'll try that to get this setup working

engcang commented 6 months ago

@ubicray Thank you for your understanding! This repository is mainly for promoting the Quatro, but not for product sales! Thus I want to keep submodules as untouched. For your new question, I guess, yes, it should work with or without little modification of code. Please let me know after you try it with the forked version of this repository!

ubicray commented 6 months ago

Interestingly enough, I keep seeing the error I mentioned regarding `nanoflann::KdTreeFLANNpcl::PointXYZI::KdTreeFLANN(nanoflann::KdTreeFLANNpcl::PointXYZI const&)' Any clue why that would be an issue? I'm starting to think it's not related to SC