How to deal with "clang: error: unsupported option '-fopenmp'" on travis?

How to deal with "clang: error: unsupported option '-fopenmp'" on travis?

我目前正在尝试使用 openmp 部署一个项目。我在 Travis 上有旗帜 '-fopenmp'

我该如何解决?

在本地,我只是 brew install libopenmp 解决了这个问题。但不是在 Travis 上,有哪些选择?

使用 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

Travis 在执行时失败:

clang -fno-strict-aliasing -fno-common -dynamic -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/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.

以下能够linkopenmp:

 - brew install llvm libomp
 - export CPP=/usr/local/opt/llvm/bin/clang;

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