mpich3 install fails due to Fortran 77

I’m installing mpich 3.3.2 using PGI compiler,
the command is:
./configure CC=pgcc CXX=pgc++ F77=pgfortran FC=pgfortran --prefix=/usr/local/mpich3 2>&1 | tee c.txt
But the installation failed and stopped at the step of checking Fortran 77. Here are some ending line of the log file:
checking whether Fortran 77 compiler accepts option -O2… no
checking how to get verbose linking output from pgfortran… -v
checking for Fortran 77 libraries of pgfortran… -L/opt/pgi/linux86-64-llvm/19.10/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/…/…/…/…/lib64 -lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgftnrtl -lpgatm -lpgkomp -lomp -lomptarget -lpthread -lpgmath -lnspgc -lpgc -lrt -lm
checking whether pgfortran accepts the FLIBS found by autoconf… no
checking for valid entries in FLIBS…
checking whether pgcc links with FLIBS found by autoconf… yes
checking whether Fortran 77 and C objects are compatible… no
checking for file… file
checking for linker for Fortran main program… configure: error: Could not determine a way to link a Fortran test program!

Could you please guide how to fix this problem?

Ha Chi

Hi Ha Chi,

The configure script auto-generates small test codes that it uses to compile in order to check certain features. Besides the unable to link error, I find it odd that the script doesn’t find that pgfortran accepts -O2 (which it does). Hence my best guess is that there’s something fundamentally wrong with your installation of the compilers.

Are you able to compile a simple program with pgfortran?

If so, can you look in the config.log file to see what the failing command is? It will be towards the bottom of the log just before where configure dumps it’s configuration information.


hi Mat,

Thank you for your time, I finally realize my mistake. I didn’t make clean before ./configure, because I have try with GNU compiler in that directory previously.

And so the config.log with the fail command is:

When I compile with the new mpich directory (i.e. untar again), the config.log shows:

Now mpich3 is successfully installed in my PC.
Ha Chi