Problem compiling PETSc

After an upgrade from PGI Fortran compilers version 15.10 to 16.1, I am getting an error when I try to compile PETSc. I never got the error earlier. The error is this:

symbol lookup error: /opt/petsc/petsc-current/optim_pgf90/lib/libpetsc.so.3.6: undefined symbol: mpi_constants_

I use the following command to configure and compile PETSc:

python2 ./configure --with-cc=gcc --download-mpich --download-hypre \
 --download-metis --download-parmetis --download-superlu \
 --download-superlu-dist --download-fblaslapack --with-debugging=0 \
 COPTFLAGS='-O3 -march=native' --with-fc=pgf90 \
 FOPTFLAGS='-fastsse -Mipa=fast,safe -Ktrap=inv,divz,ovf'

If you add -Wl,-t to the link step, you will see the order in which
the libraries are read and where the symbols come from. Since I don’t see
where your mpi libs and headers are coming from (as in adding -Mmpi ),
I assume they are coming from something you built.

nm libxxx.a |grep mpi_constants

can find the lib that contains the symbol. Then make sure that lib comes AFTER the libpetsc.so


dave

Thanks, Dave. Using ldd I found that the MPI libs came from the intel compiler, and so I found that the intel compiler (compilervars.sh script) messes with my environment in a bad way. Seems the problem is mostly solved.