OpenMPI 1.6.1 with PGI compilers installation issue

When installing the latest version of Open MPI (Version 1.6.1) with PGI compilers (specifically 12.5), the installation fails.

The following configure option are set:

CC=pgcc CXX=pgcpp F77=pgf77 FC=pgf90 ./configure --prefix=/usr/local/${BASE}-pgi --with-openib --with-tm=/usr/local/torque/latest --enable-static --enable-share

For Torque "latest" in this context is only 2.4.17, however that shouldn't be the issue. The make fails as follows:

make[6]: Leaving directory `/usr/local/src/OPENMPI/openmpi-1.6.1/ompi/contrib/vt/vt/tools/vtunify'
Making all in vtwrapper
make[6]: Entering directory `/usr/local/src/OPENMPI/openmpi-1.6.1/ompi/contrib/vt/vt/tools/vtwrapper'
CC installdirs.o
CXX vtwrapper-vt_wrapper.o
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 356: error:
identifier "omp_lock_t" is undefined
omp_lock_t _M_lock;
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 359: error:
identifier "omp_init_lock" is undefined
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 364: error:
identifier "omp_destroy_lock" is undefined
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 369: error:
identifier "omp_set_lock" is undefined
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 375: error:
identifier "omp_set_lock" is undefined
"/usr/local/pgi/linux86-64/11.9/include/CC/stl/_threads.h", line 380: error:
identifier "omp_unset_lock" is undefined
6 errors detected in the compilation of "".

... and so it goes. It is fairly clear what the problem is, and thank to Andrew Chalmers for the following work around.

In /usr/local/pgi/linux86-64/12.5/include/CC/stl/_threads.h (or similar) line 138 make the following modifications.

--# elif defined( _PGI_OMP_THREADS)
--# elif defined(_STLP_PTHREADS)
++//ALC commeted out to prod the PGI threads
++//# elif defined( _PGI_OMP_THREADS)
++//# elif defined(_STLP_PTHREADS)
++# elif defined( _PGI_OMP_THREADS)
++#include "/usr/local/pgi/linux86/12.5/include/omp.h"
++# elif defined(_STLP_PTHREADS)