缺少:OpenMP_C_标志OpenMP_C_LIB_NAMES

missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES(缺少:OpenMP_C_标志OpenMP_C_LIB_NAMES)
本文介绍了缺少:OpenMP_C_标志OpenMP_C_LIB_NAMES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在MacOSX上使用OpenMP编译一个项目。 错误为:

CMake Error at /usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
Call stack most recent call first) 
/usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/FindOpenMP.cmake:447 (find_package_handle_standard_args)
libRORPO/CMakeLists.txt:7 (find_package)

在工程中搜索OpenMP关联的CMakeList文件如下:

# RORPO Lib

project(libRORPO)
cmake_minimum_required(VERSION 2.8)

# FIND OPENMP
find_package( OpenMP REQUIRED)
if(OPENMP_FOUND)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
         ${OpenMP_EXE_LINKER_FLAGS}")
endif()

# ADD FILES
file(GLOB_RECURSE RORPO_HEADERS *.hpp *.h)
file(GLOB_RECURSE RORPO_SOURCES *.c)

add_library(RORPO ${LIB_TYPE} ${RORPO_SOURCES} ${RORPO_HEADERS})

install( FILES ${RORPO_HEADERS} DESTINATION include/libRORPO)
install( TARGETS RORPO DESTINATION lib)

我使用GCC-7和clang-omp验证了OpenMP安装是否运行良好。我也搜索过类似的虫子。回复指出,cmake中最近有一个包允许查找OpenMp。我重新安装了CMAKE以获得最新版本,但它仍然不能工作。 我不是cmake配置方面的专家,如果您能指导我,我将不胜感激。

推荐答案

我在中找到了一个解决方案:http://stechschulte.net/2016/03/20/openmp-osx-cmake.html

诀窍是cmake必须与指向clang-omp:

的CC和CXX环境变量一起运行
CC=clang-omp CXX=clang-omp++ cmake

请注意,clang-omp和clang-omp++必须在通过以下方式安装llvm后定义:

brew install llvm

并创建两个符号链接:

ln -s /usr/local/opt/llvm/bin/clang /usr/local/bin/clang-omp
ln -s /usr/local/opt/llvm/bin/clang++ /usr/local/bin/clang-omp++

这篇关于缺少:OpenMP_C_标志OpenMP_C_LIB_NAMES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Qt Calling External Python Script(Qt调用外部Python脚本)
QTableView/QTableWidget grid stylesheet - grid line width(QTableView/QTableWidget网格样式表-网格线宽)
QML opens GUI window and console(QML打开图形用户界面窗口和控制台)
How to nicely quot;castquot; qint64 to int for QProgressBar(如何为QProgressBar巧妙地将qint64转换为int)
Is it possible to use an underlined letter as keyboard shortcut in Qt?(Qt中可以使用带下划线的字母作为键盘快捷键吗?)
How to disable selection highlighting in a QTableWidget(如何在QTableWidget中禁用选定内容突出显示)