issues with system headers on Mac OSX

My system:

  • Mac OSX El Capitan 10.11.6.
  • Xcode version 8.2.1 (8C1002)
  • System compiler is Apple LLVM version 8.0.0 (clang-800.0.42.1)

I tried to build a trivial C program but it fails as follows.

$ /opt/pgi/osx86-64/16.10/bin/pgcc tls.c
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – “Unsupported compiler detected” (/usr/include/sys/cdefs.h: 81)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-S-0226-Syntax error in #if (/Library/Developer/CommandLineTools/usr/bin/…/lib/clang/8.0.0/include/stdint.h: 31)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC/x86-64 OSX 16.10-0: compilation completed with severe errors

However, when I build with C++11, there is no problem.

$ /opt/pgi/osx86-64/16.10/bin/pgc++ --c++11 tls.c

On the other hand, building with the default C++ language fails, but this makes sense since C99 fixed-width integer types were not added to C++ until C++11.

$ /opt/pgi/osx86-64/16.10/bin/pgc++ tls.c
“/usr/include/sys/_types/_int8_t.h”, line 30: error: invalid redeclaration of
type name “int8_t” (declared at line 235 of
“/Library/Developer/CommandLineTools/usr/bin/…/lib/clang/8.0.0/inclu
de/stdint.h”)
typedef __signed char int8_t;
^

1 error detected in the compilation of “tls.c”.

For completeness, neither C99 nor C11 work:

$ /opt/pgi/osx86-64/16.10/bin/pgcc -c11 tls.c
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – “Unsupported compiler detected” (/usr/include/sys/cdefs.h: 81)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-S-0226-Syntax error in #if (/Library/Developer/CommandLineTools/usr/bin/…/lib/clang/8.0.0/include/stdint.h: 31)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC/x86-64 OSX 16.10-0: compilation completed with severe errors

$ /opt/pgi/osx86-64/16.10/bin/pgcc -c99 tls.c
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – “Unsupported compiler detected” (/usr/include/sys/cdefs.h: 81)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-S-0226-Syntax error in #if (/Library/Developer/CommandLineTools/usr/bin/…/lib/clang/8.0.0/include/stdint.h: 31)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC-W-0267-#warning – This version of Xcode is not supported by PGI (/opt/pgi/osx86-64/16.10/include/sys/cdefs.h: 2126)
PGC/x86-64 OSX 16.10-0: compilation completed with severe errors

The source code is as follows.

$ cat tls.c
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

int p;
#pragma omp threadprivate(p)
int s;

int main(int argc, char **argv)
{
#pragma omp parallel
{
printf(“%d: %p %p\n”, omp_get_thread_num(), &p, &s );
}
return 0;
}

I resolved this with help from Free PGI 16.4 on OSX 10.11 (El Capitan) https://github.com/nodejs/node-gyp/issues/569, and macos - xcode-select active developer directory error - Stack Overflow.

After running “sudo xcode-select -s /Applications/Xcode.app/Contents/Developer”, I found that xcodebuild behaved more sensibly and running “sudo ./makelocalrc -x .” in $PGI_BIN make everything work.

So you upgraded Xcode after you installed the PGI compilers?

That usually requires a reinstall.

Or perhaps you did not install everything and assent to the license.
The Xcode command line tool needs to be installed and the license agreement
assented, before installing the compilers.

dave