If you build preCICE with a different version/implementation of MPI than you used for your solver, you may encounter unexpected behavior early at runtime, e.g. during configuration. In that case, make sure to build preCICE with the same version, e.g.:
spack install precice ^email@example.com
You could also tell Spack to use the MPI library installed in your system.