[petsc-users] CMake error in PETSc

Yingjie Wu yjwu16 at gmail.com
Wed Dec 4 09:18:08 CST 2019


Hi,
I feel very sorry because I sent the wrong site.  I fork the module:
https://github.com/jedbrown/cmake-modules

Thanks,
Yingjie

Yingjie Wu <yjwu16 at gmail.com> 于2019年12月4日周三 下午11:14写道:

> Dear Petsc developers
> Hi,
> Because I use some external library files, I want to compile the PETSc
> program with CMake. I follow the library search program
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt recommended
> on GitHub. And wrote a cmakelist.txt:
>
> cmake_minimum_required(VERSION 2.8.11)
> project(example01cmke)
> add_executable(example01cmke ex1.cpp)
> set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> find_package(PETSc)
> include_directories(${PETSC_INCLUDE_DIR})
> target_link_libraries(example01cmke ${PETSC_LIBRARIES})
>
> My document relationships are:
>
> yjwu at yjwu-XPS-8910:~/PETSctest/Testcmake$ tree
> .
> ├── build
> ├── cmake
> │   └── modules
> │       ├── CorrectWindowsPaths.cmake
> │       ├── FindFFTW.cmake
> │       ├── FindGit.cmake
> │       ├── FindGSL.cmake
> │       ├── FindITAPS.cmake
> │       ├── FindNetCDF.cmake
> │       ├── FindPackageMultipass.cmake
> │       ├── FindPETSc.cmake
> │       ├── LICENSE
> │       ├── README
> │       └── ResolveCompilerPaths.cmake
> ├── CMakeLists.txt
> └── ex1.cpp
>
>  After compiling with cmake.. and make, there is an error message:
>
>
> yjwu at yjwu-XPS-8910:~/PETSctest/Testcmake/build$ cmake ..
> -- The C compiler identification is GNU 5.4.0
> -- The CXX compiler identification is GNU 5.4.0
> -- Check for working C compiler: /usr/bin/cc
> -- Check for working C compiler: /usr/bin/cc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- petsc_lib_dir /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/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 - Success
> -- Minimal PETSc includes and libraries work.  This probably means we are
> building with shared libs.
> -- Found PETSc:
> /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/include;/home/yjwu/petsc-3.10.1/include
> (found version "3.10.1")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/yjwu/PETSctest/Testcmake/build
> yjwu at yjwu-XPS-8910:~/PETSctest/Testcmake/build$ make
> Scanning dependencies of target example01cmke
> [ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
> In file included from /home/yjwu/petsc-3.10.1/include/petscis.h:7:0,
>                  from /home/yjwu/petsc-3.10.1/include/petscvec.h:9,
>                  from /home/yjwu/petsc-3.10.1/include/petscmat.h:6,
>                  from /home/yjwu/petsc-3.10.1/include/petscpc.h:6,
>                  from /home/yjwu/petsc-3.10.1/include/petscksp.h:6,
>                  from /home/yjwu/petsc-3.10.1/include/petscsnes.h:6,
>                  from /home/yjwu/PETSctest/Testcmake/ex1.cpp:29:
> /home/yjwu/petsc-3.10.1/include/petscsys.h:14:23: fatal error:
> petscconf.h: No such file or directory
> compilation terminated.
> CMakeFiles/example01cmke.dir/build.make:62: recipe for target
> 'CMakeFiles/example01cmke.dir/ex1.cpp.o' failed
> make[2]: *** [CMakeFiles/example01cmke.dir/ex1.cpp.o] Error 1
> CMakeFiles/Makefile2:67: recipe for target
> 'CMakeFiles/example01cmke.dir/all' failed
> make[1]: *** [CMakeFiles/example01cmke.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
>
> I don't know how to solve this problem,ex1.cpp is the first example in
> SNES tutorial, please give me some advice.
>
> Best regards,
> Yingjie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191204/0f410579/attachment.html>


More information about the petsc-users mailing list