Clang with OpenMP on ppc64le and s390x

Hi Everyone,

I’m having trouble setting up a VM for Clang with OpenMP on ppc64le and s390x. Clang with OpenMP sets up OK on Linux and OS X.

The failed install is located at https://travis-ci.org/github/noloader/libb2/jobs/704177957.

I believe the important bits are:

if [[ "$TRAVIS_CPU_ARCH" == "ppc64le" ]] || [[ "$TRAVIS_CPU_ARCH" == "s390x" ]];
then
    if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_COMPILER" == "clang" ]];
    then
        # https://github.com/travis-ci/travis-ci/issues/9037
        sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145
        sudo apt-get -qq -y install --no-install-recommends clang-8 libomp-8-dev
    fi
fi

if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_COMPILER" == "clang" ]];
then
    sudo apt-get -qq -y install --no-install-recommends libomp-dev
fi

Does anyone know the procedure to install Clang OpenMP on ppc64le and s390x?

Clang with OpenMP is non-trivial due to compiler bugs and different package names on different platforms.

Here are some Clang bugs that effectively mean you must use clang-8 on arm64, ppc64le and s390x platforms.

To use Clang-8 with OpenMP on amd64, arm64, ppc64le and s390x, add the following before_install. Some platforms need libomp-8-dev and other platforms need libomp5-8.

before_install:
  - |
    # Clang 7 compiler is completely broken on PPC64 and s390x
    # Clang 8 is needed for OpenMP on Aarch64
    if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_COMPILER" == "clang" ]]; then
        # https://github.com/travis-ci/travis-ci/issues/9037
        sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145
        sudo apt-get -qq -y install --no-install-recommends clang-8 || true
        sudo apt-get -qq -y install --no-install-recommends libomp-8-dev || true
        sudo apt-get -qq -y install --no-install-recommends libomp5-8 || true
    fi

The trick is to install all three packages individually, and swallow failures with || true. Then use the following recipe to invoke a build with the Clang-8 compiler:

    - name: Clang, Aarch64
      os: linux
      arch: arm64
      compiler: clang
      dist: bionic
      env:
        - CC=clang-8
    - name: Clang, PPC64
      os: linux
      arch: ppc64le
      compiler: clang
      dist: bionic
      env:
        - CC=clang-8
    - name: Clang, s389x
      os: linux
      arch: s389x
      compiler: clang
      dist: bionic
      env:
        - CC=clang-8

And finally:

script:
  - |
    make CC="${CC}" -j 3
    make CC="${CC}" check