Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could NOT find OpenMP_CXX #10

Open
bot-lin opened this issue Oct 7, 2022 · 6 comments
Open

Could NOT find OpenMP_CXX #10

bot-lin opened this issue Oct 7, 2022 · 6 comments

Comments

@bot-lin
Copy link

bot-lin commented Oct 7, 2022

Laptop: Macbook Air M2
OS: Ubuntu 20.04 Docker

When I was runing cmake . , I got following error

-- 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")
-- 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:13 (find_package)


-- Configuring incomplete, errors occurred!
See also "/ARM-VO/CMakeFiles/CMakeOutput.log".
See also "/ARM-VO/CMakeFiles/CMakeError.log".

Has anyone experienced this?

Thanks

@zanazakaryaie
Copy link
Owner

zanazakaryaie commented Oct 20, 2022

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()

@bot-lin
Copy link
Author

bot-lin commented Oct 24, 2022

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".

@liaohuanxuan
Copy link

@bot-lin Hi
I have the same problem, have you solved this problem?

@bot-lin
Copy link
Author

bot-lin commented Apr 7, 2023

@liaohuanxuan I am afraid not. I have also tried it on Orange Pi with a 64bit debian OS but got the same issue.

@Hohyeong
Copy link

Hohyeong commented Apr 4, 2024

@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 -mfpu=neon -mfloat-abi=hard -funroll-loops -Ofast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -funroll-loops -Ofast")

@JasonWang9805
Copy link

嗨,我能够通过修改 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants