catkin_make in ROS Noetic [Error]
HappySamuel opened this issue · comments
I am trying to install the LIO-SAM in Ubuntu 20.04 and ROS Noetic. However i couldn't get it catkin_make.
Error 1:
GTSAM version: ppa gtsam (4.0.3)
Reason of using ppa GTSAM (4.0.3) is because failed to build GTSAM (4.0.2) from source. It failed at cmake -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF ..
Is there any solution to this error?
What's the opencv version needed for LIO-SAM?
Best,
Samuel
For me on Melodic with Opencv4.5 installed I had the change the line in utility.h to opencv2/opencv.hpp.
Hi @Rotoslider
Thanks for the info.
@TixiaoShan
I have successful tried out installing LIO-SAM with ROS Noetic, and we need to do the following changes:
Step 1: Install GTSAM 4.0.3 binary
Step 2: Configure the utility.h to use
#include <opencv2/opencv.hpp>
instead of #include <opencv/cv.h>
Step 3: Configure CMakeLists.txt to use
set(CMAKE_CXX_FLAGS "-std=c++14")
instead of set(CMAKE_CXX_FLAGS "-std=c++11")
With these 3 modifications, LIO-SAM is able to be installed on Ubuntu 20.04 and ROS Noetic. You may try it out.
Best,
Samuel
@HappySamuel this was very helpful. @TixiaoShan Can this be added to the documentation?
@HappySamuel Thanks for the post! Supper helpful!
I created a fork that compiles on Ubuntu 20.04 with ROS Noetic
Even with @HappySamuel's changes, I still encountered a strange error:
error: ‘class std::unordered_map<unsigned int, std::vector<unsigned int> >’ has no member named ‘serialize’
which was resolved by moving #include <opencv2/opencv.hpp>
after the pcl
headers.
This appears to be caused by a incompatibility between FLANN and OpenCV, whereby the USE_UNORDERED_MAP
macro leeks from the OpenCV header and is picked by FLANN. Swapping the header order resolves this issue. See flann-lib/flann#214 and https://stackoverflow.com/questions/42504592/flann-util-serialization-h-class-stdunordered-mapunsigned-int-stdvectorun for more details.
Also the stable gtsam-release-4.0
at time of writing is now 4.0.3, so it was not necessary to install GTSAM from source.
Thanks for providing information for Noetic compiling. To summarize HappySamuel and willat343's comments:
- Install GTSAM following readme
- Configure the utility.h to use
#include <opencv2/opencv.hpp>
instead of#include <opencv/cv.h>
- Configure CMakeLists.txt to use
set(CMAKE_CXX_FLAGS "-std=c++14")
instead ofset(CMAKE_CXX_FLAGS "-std=c++11")
- Move
#include <opencv2/opencv.hpp>
after thepcl
headers
According to this all that has to be done to fix the flann
serialization error is to include <pcl/kdtree/kdtree_flann.h>
before <opencv2/opencv.hpp>
. I tested this change locally and it solved the issue.
There are still some compilations issues with this now and ROS Noetic. Can anyone please help me?
把flann移到opencv前面
#include <pcl/kdtree/kdtree_flann.h>
// #include <opencv/cv.h>
#include <opencv2/opencv.hpp>