Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ubicray opened this issue Feb 16, 2024 · 8 comments

Comments

@ubicray
Copy link

ubicray commented Feb 16, 2024

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::KdTreeFLANNpcl::PointXYZI::KdTreeFLANN(nanoflann::KdTreeFLANNpcl::PointXYZI 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
Copy link
Owner

engcang commented Feb 16, 2024

@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
Copy link
Author

ubicray commented Feb 20, 2024

@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
Copy link
Owner

engcang commented Feb 20, 2024

@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
Copy link
Author

ubicray commented Feb 20, 2024

@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
Copy link
Owner

engcang commented Feb 20, 2024

@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
Copy link
Author

ubicray commented Feb 20, 2024

@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
Copy link
Owner

engcang commented Feb 20, 2024

@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
Copy link
Author

ubicray commented Feb 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants