diff --git a/dolfin/la/PETScKrylovSolver.cpp b/dolfin/la/PETScKrylovSolver.cpp
index e729093..afbde0f 100644
--- a/dolfin/la/PETScKrylovSolver.cpp
+++ b/dolfin/la/PETScKrylovSolver.cpp
@@ -496,10 +496,17 @@ void PETScKrylovSolver::monitor(bool monitor_convergence)
     PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
     PetscViewerAndFormat *vf;
     PetscViewerAndFormatCreate(viewer,format,&vf);
+    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+    ierr = KSPMonitorSet(_ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+    #else
     ierr = KSPMonitorSet(_ksp,
                          (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                          vf,
                          (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+    #endif
     if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
   }
   else
diff --git a/dolfin/nls/PETScSNESSolver.cpp b/dolfin/nls/PETScSNESSolver.cpp
index 71bca08..9761f74 100644
--- a/dolfin/nls/PETScSNESSolver.cpp
+++ b/dolfin/nls/PETScSNESSolver.cpp
@@ -516,10 +516,17 @@ void PETScSNESSolver::set_linear_solver_parameters()
       PetscViewerAndFormat *vf;
       ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
       if (ierr != 0) petsc_error(ierr, __FILE__, "PetscViewerAndFormatCreate");
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+      ierr = KSPMonitorSet(ksp,
+                           (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                           vf,
+                           (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #else
       ierr = KSPMonitorSet(ksp,
                            (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                            vf,
                            (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #endif
       if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
     }
 
diff --git a/dolfin/nls/PETScTAOSolver.cpp b/dolfin/nls/PETScTAOSolver.cpp
index cebb0de..96ecf55 100644
--- a/dolfin/nls/PETScTAOSolver.cpp
+++ b/dolfin/nls/PETScTAOSolver.cpp
@@ -576,10 +576,17 @@ void PETScTAOSolver::set_ksp_options()
         PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
         PetscViewerAndFormat *vf;
         ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+        ierr = KSPMonitorSet(ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #else
         ierr = KSPMonitorSet(ksp,
                          (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                          vf,
                          (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #endif
         if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
       }
     }
diff --git a/dolfin/nls/TAOLinearBoundSolver.cpp b/dolfin/nls/TAOLinearBoundSolver.cpp
index 0ca775c..78fa1e7 100644
--- a/dolfin/nls/TAOLinearBoundSolver.cpp
+++ b/dolfin/nls/TAOLinearBoundSolver.cpp
@@ -413,8 +413,13 @@ void TAOLinearBoundSolver::set_ksp_options()
         PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
         PetscViewerAndFormat *vf;
         ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+        ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                             vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #else
         ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                              vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #endif
         if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
       }
     }
