# 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 \
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
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.