解决 CMake 报错:找不到 MPI_Fortran、MPI 和 Trilinos 库
解决 CMake 报错:找不到 MPI_Fortran、MPI 和 Trilinos 库
在编译 svFSI 时,你可能会遇到以下 CMake 错误:
报错 -- Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS)
-- Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version '3.1')
-- ThreeDSolver Components
-- svFSILS
-- svFSI
CMake Warning at Source/svFSI/CMakeLists.txt:60 (FIND_PACKAGE):
By not providing 'FindTrilinos.cmake' in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by 'Trilinos',
but CMake did not find one.
Could not find a package configuration file provided by 'Trilinos' with any
of the following names:
TrilinosConfig.cmake
trilinos-config.cmake
Add the installation prefix of 'Trilinos' to CMAKE_PREFIX_PATH or set
'Trilinos_DIR' to a directory containing one of the above files. If
'Trilinos' provides a separate development package or SDK, be sure it has
been installed.
CMake Warning at Source/svFSI/CMakeLists.txt:97 (MESSAGE):
Could not find Trilinos. Compiling svFSI without Trilinos.
-- Generating svFSI scripts. Dev name: mysvfsi, install name: svfsi
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MPI_LIBRARY
linked by target '_simvascular_svfsils' in directory /opt/svFSI/Code/Source/svFSILS
-- Configuring incomplete, errors occurred!
See also '/opt/svFSI/Build/svFSI-build/CMakeFiles/CMakeOutput.log'.
See also '/opt/svFSI/Build/svFSI-build/CMakeFiles/CMakeError.log'.
make[2]: *** [CMakeFiles/svFSI.dir/build.make:108: svFSI-prefix/src/svFSI-stamp/svFSI-configure] Error 1
make[2]: Leaving directory '/opt/svFSI/Build'
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/svFSI.dir/all] Error 2
make[1]: Leaving directory '/opt/svFSI/Build'
make: *** [Makefile:84: all] Error 2
这些错误表明 CMake 找不到 MPI_Fortran、MPI 和 Trilinos 库。
解决方法
以下是解决这些错误的步骤:
-
安装 MPI 和 MPI_Fortran 确保你的系统上安装了 MPI 和 MPI_Fortran 库,并且已正确设置路径。你可以使用包管理器安装它们,例如:
sudo apt-get install openmpi-bin libopenmpi-dev
2. **安装 Trilinos (如果需要)**
如果你的项目需要 Trilinos 库,请安装它并将安装路径添加到 `CMAKE_PREFIX_PATH` 环境变量中,或者设置 `Trilinos_DIR` CMake 变量为包含 `TrilinosConfig.cmake` 文件的目录。例如:
```bash
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/path/to/trilinos/install
- 设置
MPI_LIBRARY变量 确保CMakeLists.txt文件中正确设置了MPI_LIBRARY变量。它应该指向 MPI 库文件的路径。
完成这些步骤后,重新运行 CMake 并尝试构建你的项目。
原文地址: http://www.cveoy.top/t/topic/fCla 著作权归作者所有。请勿转载和采集!