RobustFieldAutonomyLab / LeGO-LOAM

LeGO-LOAM: Lightweight and Ground-Optimized Lidar Odometry and Mapping on Variable Terrain
BSD 3-Clause "New" or "Revised" License
2.33k stars 1.11k forks source link

Build error on ubuntu 20.04. #215

Closed CAKGOD closed 3 years ago

CAKGOD commented 3 years ago

An error occured when I buid the LeGO-LOAM on ubuntu 20.04. The error info is shown below. /usr/include/pcl-1.10/pcl/filters/voxel_grid.h: In member function ‘std::vector<int> pcl::VoxelGrid<PointT>::getNeighborCentroidIndices(const PointT&, const MatrixXi&) const’: /usr/include/pcl-1.10/pcl/filters/voxel_grid.h:340:21: error: ‘Index’ is not a member of ‘Eigen’ 340 | for (Eigen::Index ni = 0; ni < relative_coordinates.cols (); ni++) | ^~~~~ /usr/include/pcl-1.10/pcl/filters/voxel_grid.h:340:21: note: suggested alternatives: In file included from /usr/include/opencv4/opencv2/flann.hpp:48, from /usr/include/opencv4/opencv2/opencv.hpp:65, from /home/cakgod/lego_loam/src/LeGO-LOAM/LeGO-LOAM/include/utility.h:14, from /home/cakgod/lego_loam/src/LeGO-LOAM/LeGO-LOAM/src/transformFusion.cpp:33: /usr/include/opencv4/opencv2/flann/flann_base.hpp:104:7: note: ‘cvflann::Index’ Some softwares on this system are shown below.

Can you tell me how to solve this problem? Thanks~

Wing-ka-king commented 3 years ago

Same here. Facing problems with installation on ubuntu20.04 and ros noetic

Wing-ka-king commented 3 years ago

Forcing cmake to use c++ 14 did build the package for me, with some warnings. Add this to CMakeLists.txt for LeGO-LOAM

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
LucasWEIchen commented 3 years ago

Same here, PCL lib is having problem find Eigen:Index some how?

LucasWEIchen commented 3 years ago

Forcing cmake to use c++ 14 did build the package for me, with some warnings. Add this to CMakeLists.txt for LeGO-LOAM

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

This does not work for me

ozgudum commented 3 years ago

Fix here worked for me: https://github.com/ethz-asl/lidar_align/issues/16

a temporary fix that worked for us: In /usr/include/flann/util/serialization.h at the top change the corresponding lines to:

#include "lz4.h"
#include "lz4hc.h"
juliangaal commented 3 years ago

Same here, PCL lib is having problem find Eigen:Index some how?

Have you been able to fix the issue @LucasWEIchen?

What about you @CAKGOD?

notplus commented 3 years ago

May be you can modify file /usr/include/pcl-1.10/pcl/filters/voxel_grid.h line 340 and line 669 to solve it. Just use int to substitute Eigen::Index. It works for me. old: for (Eigen::Index ni = 0; ni < relative_coordinates.cols (); ni++)

new: for (int ni = 0; ni < relative_coordinates.cols (); ni++)

davizinho5 commented 3 years ago

The solution provided by @notplus worked for me, although the change mast be done in a couple of places.

Thanks!

shikeqin123 commented 3 years ago

if you don't want to use int to substitute Eigen::Index, Specify a lower version of PCL, for exmaple, I use pcl-1.9 for instead, I add set(PCL_DIR "/usr/local/share/pcl-1.9/PCLConfig.cmake") to the CMakeLists.txt

JulianKu commented 2 years ago

@shikeqin123 For me, installing PCL 1.9 parallel to 1.11 and adding set(PCL_DIR "/usr/local/share/pcl-1.9/PCLConfig.cmake") to the CMakeLists.txt still results in Eigen::Index errors because it is still using PCL 1.11 in pcl_ros (Maybe additional reconfiguration is required?)

However, the int substitution proposed by @notplus works for me