1. Download lidar_align
sudo apt-get install libnlopt-dev
cd lidar_align-master
mkdir build
cd build
cmake .. && make -j4
The following problems may occur at this time:
Question 1:
CNake Error at /usr /share/cnake-3.10/Nodules/FindPackageHandlestandardArgs.cmake:137 (nessage);could NOT find NLOPT (missing: NLOPT_INCLUDE_DIR NLOPT_LIBRARY)
Call stack (most recent call first):
/usr/share/cnake-3.10/NModules/FindPackageHandleStandardArgs.cnake:378(_FPHSA_FAILURENLOPTConfig.cmake:65 (find_package_handle_standard_args)
CMakeLists.txt: 18 (find_package)
-- Configuring incomplete, errors occurred!
see also "/home/findlab/lidar_align-naster/build /CMakeFiles/CNakeoutput.log".See also "/hone /findlab/lidar_align-naster/build/CMakeFiles/CNakeError.log".
Solution:
Add the following code to CMakeLists.txt in the lidar_align-master folder:
list(APPEND CMAKE_FIND_ROOT_PATH ${PROJECT_SOURCE_DIR})
set (CMAKE_PREFIX_PATH "/usr/local/lib/cmake/nlopt")
Question 2:
/usr/include/flann/ext/lz4.h:196:57: error: conflicting declaration 'typedef struct LZ4_ strean_t LZ4_ strean_t'typedef struct { long long table[LZ4_STREANSIZE_U64];} LZ4_strean_t;
Solution:
Execute the following command in the terminal
sudo mv /usr/include/flann/ext/lz4.h /usr/include/flann/ext/lz4.h.bak
sudo mv /usr/include/flann/ext/lz4hc.h /usr/include/flann/ext/lz4.h.bak
sudo ln -s /usr/include/lz4.h /usr/include/flann/ext/lz4.h
sudo ln -s /usr/include/lz4hc.h /usr/include/flann/ext/lz4hc.h
Question 3:
/usr/include/pcl-1.10/pcl/point_types.h:525:1: error: ‘minusscalar’ is not a member of ‘pcl::traits’
525 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Solution:
Add the following code to CMakeLists.txt in the lidar_align-master file:
set(CMAKE_CXX_STANDARD 14)
Question 4:
In file included from /home/hzw/lidar_align-master/src/aligner.cpp:1:
/home/hzw/lidar_align-master/include/lidar_align/aligner.h:7:10: fatal error: nlopt.hpp: None That file or directory
7 | #include <nlopt.hpp>
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/lidar_align.dir/build.make:76: CMakeFiles /lidar_align.dir/src/aligner.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1165: CMakeFiles/lidar_align.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Solution:
Install nlopt
git clone https://github.com/stevengj/nlopt
cd nlopt
mkdir build
cd build
cmake .. && make -j4
sudo make install
Finally compiled successfully