如何处理特拉维斯"clang: error: unsupported option '-fopenmp'"?



我目前正在尝试使用openmp部署一个项目。我有特拉维斯'-fopenmp'旗帜。

我该如何解决?

在本地,我只是brew install libopenmp解决了问题。但不是在特拉维斯,有什么选择?

使用cython,我得到了以下".travis.yml">

os: linux
dist: xenial
language: python
python:
- "3.7"
cache: pip
addons:
apt:
packages:
- patchelf
matrix:
include:
- os: osx
# No version of Python is available via virtualenv on OS X workers, see https://github.com/travis-ci/travis-ci/issues/2312
language: generic
env: TOXENV=py37
fast_finish: true
before_install:
brew install libomp
install:
- pip install --upgrade "pip < 19.1" -r CI/requirements.txt
- python setup.py develop
script:
- pytest

特拉维斯在执行时失败:

clang -fno-strict-aliasing -fno-common -dynamic -i/applications/Xcode.app/Content/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/

Applications/Xcode.app/Content/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cpt/alphabet.c -o build/temp.macosx-10.13-x86_64-2.7/cpt/alphabet.o -fopenmp

在本地它使用python 3.7编译时,我该如何解决这个问题?

在苹果的llvm上,不支持-fopenmp。应该使用brew的llvm

以下命令将允许链接openmp

brew install llvm libomp
export CC=/usr/local/opt/llvm/bin/clang

作为参考,存在所有命令的问题:https://github.com/bluesheeptoken/CPT/issues/68#issuecomment-563342866

这是在MacOS Ventura上对我有用的:

brew install llvm@11
LLVM_CONFIG="/opt/homebrew/Cellar/llvm@11/11.1.0_4/bin/llvm-config" pip install llvmlite
export CC=/opt/homebrew/Cellar/llvm@11/11.1.0_4/bin/clang

相关内容

最新更新