Open bot-lin opened 2 years ago
Hi @bot-lin Finding and linking OpenMP on Mac devices sometimes becomes tricky. Can you add these lines to the cmake file and run it again?
if(NOT TARGET OpenMP::OpenMP_CXX)
add_library(OpenMP_TARGET INTERFACE)
add_library(OpenMP::OpenMP_CXX ALIAS OpenMP_TARGET)
target_compile_options(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS})
find_package(Threads REQUIRED)
target_link_libraries(OpenMP_TARGET INTERFACE Threads::Threads)
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS})
endif()
Hi, @zanazakaryaie Thaks for your reply.
I have added the line to the cmake file and this is how my cmake file looks like
cmake_minimum_required(VERSION 2.8)
project(ARM_VO)
SET(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -mfpu=neon -mfloat-abi=hard -funroll-loops -Ofast")
find_package(OpenCV REQUIRED)
if(NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV not found.")
endif()
if(NOT TARGET OpenMP::OpenMP_CXX)
add_library(OpenMP_TARGET INTERFACE)
add_library(OpenMP::OpenMP_CXX ALIAS OpenMP_TARGET)
target_compile_options(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS})
find_package(Threads REQUIRED)
target_link_libraries(OpenMP_TARGET INTERFACE Threads::Threads)
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS})
endif()
find_package(OpenMP REQUIRED)
if(OpenMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
else()
message(WARNING "OpenMP not found.")
endif()
include_directories(include)
file(GLOB SOURCES "src/*.cpp")
add_executable(ARM_VO ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
Anf the cmake output is as following:
zl@zl-Parallels-ARM-Virtual-Machine:~/ARM-VO$ cmake .
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.5.0")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found OpenMP_C: -fopenmp (found version "4.5")
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindOpenMP.cmake:511 (find_package_handle_standard_args)
CMakeLists.txt:23 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/zl/ARM-VO/CMakeFiles/CMakeOutput.log".
See also "/home/zl/ARM-VO/CMakeFiles/CMakeError.log".
@bot-lin Hi I have the same problem, have you solved this problem?
@liaohuanxuan I am afraid not. I have also tried it on Orange Pi with a 64bit debian OS but got the same issue.
@bot-lin @liaohuanxuan Hi, I was able to successfully configure cmake on a Raspberry Pi 4B model using the Bullseye OS by modifying CMakeLists.txt:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -funroll-loops -Ofast")
嗨,我能够通过修改 Bullseye OS 在 Raspberry Pi 4B 模型上成功配置 cmake CMakeLists.txt:
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -O3 -std=c++11 -mfpu=neon -mfloat-abi=hard -funroll-loops -Ofast”) set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -O3 -std=c++11 -funroll-loops -Ofast”)
Thanks! I had a successful build based on your methodology on an nvidia device
Laptop: Macbook Air M2 OS: Ubuntu 20.04 Docker
When I was runing cmake . , I got following error
Has anyone experienced this?
Thanks