如何处理 travis 上的“clang: error: unsupported option '-fopenmp'”?

Blu*_*ken 17 openmp cython travis-ci

我目前正在尝试使用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
Run Code Online (Sandbox Code Playgroud)

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,我该如何解决这个问题?

Blu*_*ken 16

在苹果上llvm-fopenmp不支持。人们应该使用brew's llvm

以下命令将允许链接openmp

brew install llvm libomp
export CC=/usr/local/opt/llvm/bin/clang
Run Code Online (Sandbox Code Playgroud)

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