flann-lib / flann

Fast Library for Approximate Nearest Neighbors
http://people.cs.ubc.ca/~mariusm/flann
Other
2.22k stars 647 forks source link

undefined reference to `LZ4_decompress_safe' for flann 1.9, ubuntu 18.04 #438

Open jubaer145 opened 4 years ago

jubaer145 commented 4 years ago

while running the make command to compile point cloud program, this error shows CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In functionflann::serialization::SaveArchive::initBlock()': pcd_read.cpp:(.text._ZN5flann13serialization11SaveArchive9initBlockEv[_ZN5flann13serialization11SaveArchive9initBlockEv]+0xc2): undefined reference to LZ4_resetStreamHC' CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In functionflann::serialization::SaveArchive::flushBlock()': pcd_read.cpp:(.text._ZN5flann13serialization11SaveArchive10flushBlockEv[_ZN5flann13serialization11SaveArchive10flushBlockEv]+0xcb): undefined reference to LZ4_compress_HC_continue' pcd_read.cpp:(.text._ZN5flann13serialization11SaveArchive10flushBlockEv[_ZN5flann13serialization11SaveArchive10flushBlockEv]+0x19e): undefined reference toLZ4_compress_HC_continue' CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In function flann::serialization::LoadArchive::decompressAndLoadV10(_IO_FILE*)': pcd_read.cpp:(.text._ZN5flann13serialization11LoadArchive20decompressAndLoadV10EP8_IO_FILE[_ZN5flann13serialization11LoadArchive20decompressAndLoadV10EP8_IO_FILE]+0x255): undefined reference toLZ4_decompress_safe' CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In function flann::serialization::LoadArchive::initBlock(_IO_FILE*)': pcd_read.cpp:(.text._ZN5flann13serialization11LoadArchive9initBlockEP8_IO_FILE[_ZN5flann13serialization11LoadArchive9initBlockEP8_IO_FILE]+0x21b): undefined reference toLZ4_setStreamDecode' CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In function flann::serialization::LoadArchive::loadBlock(char*, unsigned long, _IO_FILE*)': pcd_read.cpp:(.text._ZN5flann13serialization11LoadArchive9loadBlockEPcmP8_IO_FILE[_ZN5flann13serialization11LoadArchive9loadBlockEPcmP8_IO_FILE]+0xe4): undefined reference toLZ4_decompress_safe_continue' CMakeFiles/pcd_read.dir/pcd_read.cpp.o: In function pcl::VFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308>::computePointSPFHSignature(Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, pcl::PointCloud<pcl::PointXYZ> const&, pcl::PointCloud<pcl::Normal> const&, std::vector<int, std::allocator<int> > const&)': pcd_read.cpp:(.text._ZN3pcl13VFHEstimationINS_8PointXYZENS_6NormalENS_15VFHSignature308EE25computePointSPFHSignatureERKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEES9_RKNS_10PointCloudIS1_EERKNSA_IS2_EERKSt6vectorIiSaIiEE[_ZN3pcl13VFHEstimationINS_8PointXYZENS_6NormalENS_15VFHSignature308EE25computePointSPFHSignatureERKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEES9_RKNS_10PointCloudIS1_EERKNSA_IS2_EERKSt6vectorIiSaIiEE]+0x385): undefined reference topcl::computePairFeatures(Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, float&, float&, float&, float&)' collect2: error: ld returned 1 exit status CMakeFiles/pcd_read.dir/build.make:329: recipe for target 'pcd_read' failed make[2]: [pcd_read] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pcd_read.dir/all' failed make[1]: [CMakeFiles/pcd_read.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2`

OS: Ubuntu 18.04 PCL: latest Flann: latest

jrobichaud commented 4 years ago

Did you install liblz4-dev?

apt-get update && apt-get install liblz4-dev
rimmartin commented 4 years ago

do you want lz4 compression?

naikf commented 3 years ago

Any one fixed this issue - undefined reference to symbol 'LZ4_decompress_safe_continue'

Environment: Its in ubuntu with [ libflann-dev is already the newest version (1.9.1+dfsg-2) ].

Build error occur when you use something like pcl::search::KdTree

Akpool commented 2 years ago

nobody else had this issue or fixed it? Have the same in Ubuntu 20 liblz4-dev is installed libflann-dev newest version

Hexmagic commented 2 years ago

nobody else had this issue or fixed it? Have the same in Ubuntu 20 liblz4-dev is installed libflann-dev newest version

add this in CMakeLists.txt

find_library(LZ4_LIBRARIES NAMES liblz4.so HINTS "lz4/lib")
link_libraries(${LZ4_LIBRARIES})

this solve my problem

fwanderlingh commented 1 year ago

Why is this issue still open? @Hexmagic suggestion solves the problem! :)

DocZain commented 9 months ago

nobody else had this issue or fixed it? Have the same in Ubuntu 20 liblz4-dev is installed libflann-dev newest version

add this in CMakeLists.txt

find_library(LZ4_LIBRARIES NAMES liblz4.so HINTS "lz4/lib")
link_libraries(${LZ4_LIBRARIES})

this solve my problem

This is my solution:

find_library(LZ4_LIBRARIES NAMES liblz4.so HINTS "lz4/lib")
link_libraries(${LZ4_LIBRARIES})
add_definitions(${LZ4_DEFINITIONS})