Error:
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:93: undefined reference to `omp_get_num_threads'
CMakeFiles/ndt_feature_eval.dir/src/ndt_feature_eval.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:105: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_start'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_eval.dir/src/ndt_feature_eval.o: In function `nbThreads':
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:47: undefined reference to `omp_get_max_threads'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ndt_feature_eval] Error 1
make[3]: Leaving directory `/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_feature_reg/build'
make[2]: *** [CMakeFiles/ndt_feature_eval.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Linking CXX executable ../bin/ndt_feature_reg_node
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `lslgeneric::NDTMatcherD2D
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `omp_get_num_threads'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `omp_get_thread_num'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `GOMP_barrier'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:131: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:131: undefined reference to `omp_get_thread_num'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `lslgeneric::NDTMatcherD2D
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1550: undefined reference to `GOMP_parallel_start'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1550: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `Eigen::internal::general_matrix_matrix_product
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:92: undefined reference to `omp_get_thread_num'
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:93: undefined reference to `omp_get_num_threads'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:105: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_start'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `nbThreads':
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:47: undefined reference to `omp_get_max_threads'
collect2: ld returned 1 exit status
Solution:
Add these lines in your CMakeLists.txt
#check for OpenMP
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
if(MSVC90 OR MSVC10)
if(MSVC90)
set(OPENMP_DLL VCOMP90)
elseif(MSVC10)
set(OPENMP_DLL VCOMP100)
endif(MSVC90)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DELAYLOAD:${OPENMP_DLL}D.dll")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DELAYLOAD:${OPENMP_DLL}.dll")
endif(MSVC)
else(OPENMP_FOUND)
message (STATUS "OpenMP not found")
endif()
if (MSVC)
Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /O2 ${SSE_FLAGS}")
else (MSVC)
set(CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS} ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE " ${CMAKE_CXX_FLAGS} -O3 ${SSE_FLAGS}")
endif (MSVC)
No comments:
Post a Comment