我试图在Windows的Windows子系统中运行的Ubuntu上安装PETSc,但是详细的步骤on the official webpage导致编译错误。
首先,我克隆了PETSc存储库并运行了配置命令:./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-openmpi --download-fblaslapack
,该命令有效。 (我之前已经安装过OpenMPI,但是没有--download-openmpi
开关,configure命令就无法工作。)然后我执行了./configure代码(make PETSC_DIR=/mnt/c/Stuff/Petsc/petsc PETSC_ARCH=arch-linux2-c-debug all
)的make命令输出,并得到了此错误:
In file included from /mnt/c/Stuff/Petsc/petsc/src/mat/order/qmdmrg.c:4:0:
/mnt/c/Stuff/Petsc/petsc/include/petscsys.h:134:12: fatal error: mpi.h: No such file or directory
# include <mpi.h>
^~~~~~~
compilation terminated.
gmakefile:153: recipe for target 'arch-linux2-c-debug/obj/mat/order/qmdmrg.o' failed
make[2]: *** [arch-linux2-c-debug/obj/mat/order/qmdmrg.o] Error 1
(完整的make输出为here,上面的错误只是一小部分。)显然,PETSc make例程找不到MPI,但是我已经安装了它:运行which mpicc
给出了预期/usr/bin/mpicc
。有人有主意吗?感谢您的帮助!
答案 0 :(得分:0)
解决方案非常简单:我刚运行make all test
。与建议的命令不同。