【问题标题】:Cannot use petsc with cmake不能将 petsc 与 cmake 一起使用
【发布时间】:2017-03-14 16:12:17
【问题描述】:

我试图构建一个使用 PETSc 的项目。为此,我从 https://github.com/jedbrown/cmake-modules 下载了 cmake 模块。当我尝试构建项目时,我收到以下错误消息:

(...)

-- petsc_lib_dir /cygdrive/d/Git-Projects/build_libs/INSTALL/petsc-3.7.5/lib
-- Recognized PETSc install with single library for all packages
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Failed
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Failed
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries
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:
PETSC_LIBRARY_SINGLE
    linked by target "cmTC_bb78d" in directory /cygdrive/d/Git-Projects/EFVLib_dev/EFVLib/_build/CMakeFiles/CMakeTmp

CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed
-- Performing Test MULTIPASS_TEST_4_petsc_works_all
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:
PETSC_LIBRARY_SINGLE
    linked by target "cmTC_9aa2b" in directory /cygdrive/d/Git-Projects/EFVLib_dev/EFVLib/_build/CMakeFiles/CMakeTmp

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:
PETSC_LIBRARY_SINGLE (ADVANCED)

我已经下载了 openMPI(cygwin 包)并使用以下方法构建了 Petsc:

"--prefix="where_petsc_will_be_installed" --with-clanguage=C --with-mpi --with-cc=mpicc --with-cxx=0 --with-fc=0 --download-f2cblaslapack - -with-debugging=yes"

并使用以下方式导出路径:

export PETSC_DIR="where_petsc_is_installed"
export PETSC_ARCH=""
export PATH=${PATH}:${PETSC_DIR}/lib:${PETSC_DIR}/bin

为什么会出现这些错误以及如何解决?

【问题讨论】:

    标签: cmake petsc


    【解决方案1】:

    为了在cygwin中使用petsc和cmake,它必须使用“--with-shared-libraries=0”构建,你必须使用静态库。

    【讨论】:

      猜你喜欢
      • 2015-04-08
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-17
      • 2019-02-01
      • 2016-07-25
      相关资源
      最近更新 更多