Skip to content

Compiling the setup.py against g++-6 rather than clang 10.0.x on Mac OS X High Sierra and Mojave

Having experienced a compilation failure of HiPeCTA under Mac OS X High Sierra equipped with clang 10.0.x as default C++ compiler, I managed to work around it this way:

  1. install gcc-6 and g++-6 via Homebrew:

brew install gcc@6

  1. add the path to g++-6 (possibly) in front of your PATH variable (in your .bashrc or .bash_profile, apparently the path is the same for all Mac OS X distributions):

export PATH="/usr/local/Cellar/gcc@6/6.5.0/bin:$PATH"

  1. then, add the following three lines to the setup.py:

import os

os.environ["CC"] = "gcc-6"

os.environ["CXX"] = "g++-6"

Finally, try to run the installation, which now should work correctly since it is not compiling against clang anymore! Maybe there is a way to fix the issue also by upgrading clang to 10.1 or higher, but I write this solution down anyway should it be useful also to avoid compatibility issues.

NOTE: such instructions also work for Mojave, catalina with gcc-9.

Edited by Gilles Maurin