14

I am currently trying to deploy a project using openmp. I have the flag '-fopenmp' on Travis.

How could I fix that ?

In local I just brew install libopenmp which solved the issue. But not on Travis, what are the options ?

Using cython I got the following ".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 fails while executing :

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

While in local it compiles with python 3.7, how could I fix that aswell ?

BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42

2 Answers2

12

On apple's llvm, -fopenmp is not supported. One should use brew's llvm.

The following commands will allow linking openmp:

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

For reference, the issue where there are all the commands: https://github.com/bluesheeptoken/CPT/issues/68#issuecomment-563342866

ijoseph
  • 6,505
  • 4
  • 26
  • 26
BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42
-1

This is what worked for me on 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
ChrisDanger
  • 1,071
  • 11
  • 10