# Clang with OpenMP on ppc64le and s390x

**URL:** <https://travis-ci.community/t/clang-with-openmp-on-ppc64le-and-s390x/9209>\
**Category:** Linux\
**Created:** [July 2, 2020, 4:40am UTC](https://travis-ci.community/t/clang-with-openmp-on-ppc64le-and-s390x/9209 "2020-07-02T04:40:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![noloader](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/noloader/32/2971_2.png) [@noloader](https://travis-ci.community/u/noloader)\
**Post date:** [July 2, 2020, 4:40am UTC](https://travis-ci.community/t/clang-with-openmp-on-ppc64le-and-s390x/9209/1 "2020-07-02T04:40:10Z")

</div>

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](https://travis-ci.org/github/noloader/libb2/jobs/704177957).

I believe the important bits are:

```auto
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?

---

<div class="post-metadata">

**Author:** ![noloader](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/noloader/32/2971_2.png) [@noloader](https://travis-ci.community/u/noloader)\
**Post date:** [July 4, 2020, 12:03am UTC](https://travis-ci.community/t/clang-with-openmp-on-ppc64le-and-s390x/9209/2 "2020-07-04T00:03:04Z")

</div>

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.

- [https://bugs.llvm.org/show\_bug.cgi?id=39704](https://bugs.llvm.org/show_bug.cgi?id=39704)
- [https://bugs.llvm.org/show\_bug.cgi?id=46571](https://bugs.llvm.org/show_bug.cgi?id=46571)
- [https://bugs.llvm.org/show\_bug.cgi?id=46572](https://bugs.llvm.org/show_bug.cgi?id=46572)

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`.

```auto
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:

```auto
    - 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:

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

```
