pgfortran link error on macOS Catalina

Hello! Sorry if this is a FAQ but I couldn’t find anything related using search.

I installed the free version of PGI-1910.dmg on macOS 10.15.2 and went through the Terminal configuration steps at https://www.pgroup.com/resources/docs/19.10/x86/pgi-install-guide/index.htm#install-osx-end-usr-env-settings. As a first test I was able to compile by fortran program files without any issues with this command:

pgfortran -c *.F

but when I try to link I get this error:

pgfortran -o nec4d42 *.o
ld: warning: directory not found for option '-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64'
ld: warning: directory not found for option '-L/usr/lib/gcc/i686-apple-darwin10/4.2.1'
ld: file not found: /usr/lib/crt1.o

The installation instructions say any XCode 6.3 or newer will work. I have XCode 11 so that statement is clearly incorrect. But anyway I tried downloading XCode 6.3 from Apple. That version is from 2015 and I found it won’t even run on Catalina at all. So I seem to be stuck: can’t install until I get an older XCode but older XCode won’t install on Catalina.

Any help would be appreciated.

PS: Many thanks for the free version. My goal is to find tools that build my E&M modeling program to get better performance than I am getting with brew gfortran. I found your company with a google search for macOS fortran.

You need to regenerate the bin/localrc file. Xcode 11 is unsupported and untested but you can force the bin/makelocalrc script to generate one by adjusting the check for the Xcode version.

446 if test $xcodever -gt 10 ; then
447      echo " Error: Unsupported XCode version "  $xcodever
448      exit  -1
449 fi

Navigate to bin/ and ./makelocalrc -x as root to write a new localrc file. You will need to have xcode command line tools installed (can do so with xcode-select --install). The new localrc should have values set to Xcode’s toolchain, e.g.:

set GCCDIR=/Applications/Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1;
set GCCINC=/usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks;

If you get errors about missing /usr/lib/crt1.o, you will need to symlink the one provided by Xcode (e.g. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.o) to that location. You’ll also need to disable SIP (https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html) before you’re able to write into /usr/lib, even as root.

Many thanks for the helpful response. I just had to hack the makelocalrc file, there was no issue with crt1.o.

Unfortunately the results are disappointing. I tried building and running my test program with pgfortran two ways: with no args and with -fast. There are no errors or warnings during compilation or building. They both take about 4x longer to execute (6.8 vs 1.7 s) compared to brew gfortran -O3. Worse, each variation produces different output values, differing by factors of 10 or more from each other and the correct values produced by gfortran.

So this was an epic fail. Sorry.

If you can post the code, I can take a look and see what accounts for the difference. Can’t really compare performance until we understand the verification issues. Though both could be caused by numerical stability issues, so the first thing to try is adding “-Kieee” so strict IEEE 754 compliance is enforced and/or add “-r8” to promote default REALs to double precision.

-Mat

Of course you are correct but unfortunately I am not allowed to post the code.

Those options made little difference in time or accuracy.

Also just tried intel fortran “ifort”. Same numeric results as gfortran but almost 2x faster. A clear winner!

Thanks everyone for the help.