Q:

Compiling OpenMPI with AOCC clang (configure error: no working posix pthread package)

I am trying to build OpenMPI on an eight-core AMD Ryzen CPU (1700). I have downloaded and installed the AOCC bundle of compilers.  The OpenMPI version that I am trying to compile is a clone of the master branch.
Steps that led to the problem:

source setenv_AOCC.sh (this sets up the AOCC bundle (by polluting your environment))
cd into the build dir
$ompisrcdir/configure CC=clang --prefix="$HOME/$localmpiinst"

Configure goes on until:
checking for _SC_NPROCESSORS_ONLN... yes
checking whether byte ordering is bigendian... no
checking for broken qsort... no
checking if C compiler and POSIX threads work as is... no
checking if C++ compiler and POSIX threads work as is... no
checking if Fortran compiler and POSIX threads work as is... no
checking if C compiler and POSIX threads work with -Kthread... no
checking if C compiler and POSIX threads work with -kthread... no
checking if C compiler and POSIX threads work with -pthread... yes
checking if C++ compiler and POSIX threads work with -Kthread... no
checking if C++ compiler and POSIX threads work with -kthread... no
checking if C++ compiler and POSIX threads work with -pthread... no
checking if C++ compiler and POSIX threads work with -pthreads... no
checking if C++ compiler and POSIX threads work with -mt... no
checking if C++ compiler and POSIX threads work with -mthreads... no
checking if Fortran compiler and POSIX threads work with -Kthread... no
checking if Fortran compiler and POSIX threads work with -kthread... no
checking if Fortran compiler and POSIX threads work with -pthread... yes
checking if C++ compiler and POSIX threads work with -lpthreads... no
checking if C++ compiler and POSIX threads work with -llthread... no
checking if C++ compiler and POSIX threads work with -lpthread... no
checking for pthread_mutexattr_setpshared... yes
checking for pthread_condattr_setpshared... yes
checking for PTHREAD_MUTEX_ERRORCHECK_NP... yes
checking for PTHREAD_MUTEX_ERRORCHECK... yes
checking for working POSIX threads package... no
configure: WARNING: "*** POSIX threads are not"
configure: WARNING: "*** available on your system "
configure: error: "*** Can not continue"

So, it dies checking for POSIX threads c++ support.
output of clang --version:
AOCC.LLVM.1.3.0.B34.2018_10_22 clang version 7.0.0 (CLANG: Jenkins 
AOCC_1_3_0_Release-Build#34) (based on LLVM AOCC.LLVM.1.3.0.B34.2018_10_22)
Target: x86_64-unknown-linux-gnu

A:

Okay, the solution is, actually, simple.
I was supposed to supply the CXX flag to the configure script. So, instead of,
$ompisrcdir/configure CC=clang --prefix="$HOME/$localmpiinst"

the following works,
$ompisrcdir/configure CC=clang **CXX=clang++** --prefix="$HOME/$localmpiinst"

