Inconsistent pgCC behavior between PGI 11 and 12 versions

The following crops up in the configure step to Open-MPI:

#include <string>
int
main ()
{
std::string foo = "Hello, world"
  ;
  return 0;
}

For reasons already reported, in order to get things to compile with PGI we have to add the -nomp flag to the compile line. -mp=nonuma will not work.

Under PGI 11.10 this compiles correctly:

pgCC -V -o conftest conftest.cpp -nomp

pgCC 11.10-0 64-bit target on x86-64 Linux -tp gh 
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.
Edison Design Group C/C++ Front End, version 4.1 (Sep  8 2011 16:47:20)
Copyright 1988-2009 Edison Design Group, Inc.

PGCC/x86 Linux 11.10-0
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.

But it fails to compile using 12.1:

pgCC -V -o conftest conftest.cpp -nomp

pgCC 12.1-0 64-bit target on x86-64 Linux -tp gh 
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2012, STMicroelectronics, Inc.  All Rights Reserved.
Edison Design Group C/C++ Front End, version 4.1 (Dec 16 2011 14:28:53)
Copyright 1988-2009 Edison Design Group, Inc.

PGCC/x86 Linux 12.1-0
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2012, STMicroelectronics, Inc.  All Rights Reserved.
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_get_thread_num':
omp.c:(.text+0x8d): undefined reference to `_mp_lcpu2'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_get_num_procs':
omp.c:(.text+0x9d): undefined reference to `_mp_avlcpus'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_get_max_threads':
omp.c:(.text+0xc1): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_in_parallel':
omp.c:(.text+0xe0): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_set_nest_lock':
omp.c:(.text+0x1e4): undefined reference to `_mp_lcpu3'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_unset_nest_lock':
omp.c:(.text+0x23f): undefined reference to `_mp_lcpu3'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_test_nest_lock':
omp.c:(.text+0x2b6): undefined reference to `_mp_lcpu3'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_get_stack_size':
omp.c:(.text+0x3b3): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_set_stack_size':
omp.c:(.text+0x3ee): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `omp_get_level':
omp.c:(.text+0x44e): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `smp_get_thread_num':
omp.c:(.text+0x4c5): undefined reference to `_mp_lcpu2'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(omp.o): In function `pgi_mythread':
omp.c:(.text+0x4f5): undefined reference to `_mp_lcpu2'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(lcpu.o): In function `_mp_lcpu_reset':
lcpu.c:(.text+0x7e): undefined reference to `_mp_pcpu_team'
lcpu.c:(.text+0xb0): undefined reference to `_mp_pcpu_reset'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(lcpu.o): In function `_mp_lcpu_init':
lcpu.c:(.text+0xc5): undefined reference to `_mp_pcpu_init'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(lcpu.o): In function `_mp_ncpus2':
lcpu.c:(.text+0xdf): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(lcpu.o): In function `_mp_ncpus3':
lcpu.c:(.text+0xf4): undefined reference to `_mp_pcpu_team'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(lcpu.o): In function `omp_set_num_threads':
lcpu.c:(.text+0x113): undefined reference to `_mp_pcpu_get_team_lcpu'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(preinit2.o): In function `_mp_preinit2':
preinit2.c:(.text+0x75): undefined reference to `_mp_pcpu_team'
preinit2.c:(.text+0x432): undefined reference to `_mp_avlcpus'
preinit2.c:(.text+0x623): undefined reference to `_mp_setaff'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(barrier.o): In function `_mp_barrier':
barrier.c:(.text+0x14): undefined reference to `_mp_pcpu_get_team_lcpu'
barrier.c:(.text+0x96): undefined reference to `_mp_pcpu_yield'
barrier.c:(.text+0x120): undefined reference to `_mp_pcpu_yield'
barrier.c:(.text+0x202): undefined reference to `_mp_pcpu_yield'
barrier.c:(.text+0x29b): undefined reference to `_mp_pcpu_yield'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(barrier.o): In function `_mp_barrierw':
barrier.c:(.text+0x3be): undefined reference to `_mp_pcpu_yield'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(barrier.o):barrier.c:(.text+0x46b): more undefined references to `_mp_pcpu_yield' follow
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(barrier.o): In function `_mp_barrierx':
barrier.c:(.text+0x546): undefined reference to `_mp_pcpu_get_team_lcpu'
/usr/projects/hpcsoft/turing/pgi/linux86-64/12.1/lib/libpgc.a(barrier.o): In function `_mp_pexit_reg':
barrier.c:(.text+0x59a): undefined reference to `_mp_pcpu_team'

Hi David,

Thanks for the report. It looks like we fixed this in 12.4 (TPR#18444).

% pgCC test.cpp -nomp -V12.2
/usr/pgi/linux86-64/12.2/lib/libpgc.a(omp.o): In function `omp_get_thread_num':
omp.c:(.text+0x8d): undefined reference to `_mp_lcpu2'
/usr/pgi/linux86-64/12.2/lib/libpgc.a(omp.o): In function `omp_get_num_procs':
... cut ...
% pgCC test.cpp -nomp -V12.4
%

Best Regards,
Mat