Runnning PGI 19.10 on macOS Big Sur with XCode 12

I had to get PGI 19.10 to work on macOS Big Sur with XCode 12 to build some software (Gaussian). Even though not officially supported it seems to work with minor adjustments.

I already had PGI 19.10 installed prior to the update and it might not even be possible to install it on newer macOS, but if you already have PGI 19.x installed and updated to Big Sur, here are some instructions to make it run:

  1. After an update of macOS/XCode, you probably have to run makelocalrc to update the include/library paths. But makelocalrc contains a version check for XCode, hence “fix” the version check in bin/makelocalrc by changing

    if test $xcodever -gt 11 ; then
    

    to

    if test $xcodever -gt 12 ; then
    

    Then run: sudo makelocalrc -x /opt/pgi/osx86-64/19.10.

  2. Compiling software may fail at the linker step stating that either -lpthread or the Security framework could not be found (even though you haven’t specified either). Comparing the linker invocation emitted by pgcc/pgf77/pgf90 by running pgcc -v somefile.c and comparing to clang -v somefile.c reveals that -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk is missing. Add it to the EXTRAPGILNKOPT variable in bin/osxrc:

    variable EXTRAPGILNKOPT is default (-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Security -framework IOKit -framework CoreFoundation);
    

After that I was able to use pgcc, pgf77 and pgf90 again to build functional executables.