Error in compilation on Ubuntu 22.04

I’m trying to build ngsolve with MUMPS, MPI, and MKL on two 64-bit machines running Ubuntu 20.04 and 22.04 respectively. (I’m using virtual machine instances for now, in case it matters).

I managed to get things up and running on 20.04, but not on 22. Particularly, I can configure the make file with no error, but make raises a number of errors in ana_orderings_wrappers_m.F. Something like the following (lines:315:39):

Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
make[6]: *** [Makefile:381: ana_orderings_wrappers_m.o] Error 1
make[5]: *** [Makefile:20: c] Error 2
make[4]: *** [Makefile:40: mumps_lib] Error 2
make[3]: *** [Makefile:18: c] Error 2
make[2]: *** [CMakeFiles/project_mumps.dir/build.make:86: dependencies/src/project_mumps-stamp/project_mumps-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:254: CMakeFiles/project_mumps.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

These are my steps for installing ngsolve on Ubuntu 20.04:
[]I installed the dependencies mentioned in the docs.
]In addition, I installed all MP implementations, as well as MKL as follows:
[]sudo apt-get install openmpi-bin libopenmpi-dev mpich intel-mkl-full
]I added the installation locations to my path so that make can find these packages later (although, probably I could have given them as argument too)
[]After a number of trials, turned out for running the example files I need to install mpi4python and mkl (in my python environment) which I did using pip3.
]python3 -m pip install mpi4py mkl
[]And finally configured my makefile as follows:
My questions:

  1. Why isn’t this procedure work in Ubuntu 22.04? It seems to me the code is not compiled. But unfortunately, my understanding of Fortran is next to nothing.
  2. I had a painful experience with installing MPICH and openMP side by side, especially on a cluster, and I reckon that what I have done above is actually a bad practice. How can I avoid that?
  3. I failed to installed with BLAS/LAPACK and that’s why I switched to MKL. But is it necessary? Can I avoid these extra installations?



I had the same problems. Before the cmake, I tried his comman line:

export FFLAGS=“-fallow-argument-mismatch”

but it did not help. Are there any new achievements?

Best, Mario


I am also no Fortran expert. Since your problem is about building Mumps (the only dependency here with Fortran source code), I suggest to disable it first and fix all other issues (if any).
Concerning Mumps: Did you try different Fortran compilers/versions? Which one are you using?


This error can be fixed by the following patch:

diff --git a/cmake/external_projects/ b/cmake/external_projects/
index effe76f54…6c77bc95b 100644
— a/cmake/external_projects/
+++ b/cmake/external_projects/
@@ -32,7 +32,7 @@ CDEFS = -DAdd_

#Begin Optimized options

uncomment -fopenmp in lines below to benefit from OpenMP

-OPTF = -O -fPIC -DALLOW_NON_INIT # -fopenmp
+OPTF = -O -fPIC -DALLOW_NON_INIT -fallow-argument-mismatch # -fopenmp
OPTL = -O -fPIC # -fopenmp
OPTC = -O -fPIC # -fopenmp
#End Optimized options

To be honest, I have not tested this patch extensively.
It worked on our systems but I would use it with caution.