<div dir="ltr">Jed,<div><br></div><div>After all was removed, I see a new error from FindPETSc.cmake. </div><div>I added to cmake </div><div><div>SET(CMAKE_CXX_COMPILER mpicxx)</div><div>FIND_PACKAGE(MPI REQUIRED)</div><div>INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})</div></div><div>and tested but no luck.</div><div><br></div><div>It seems that I need to let FindPETSc.cmake know a compiler location. Thanks for your help.</div><div><br></div><div>Evan <br></div><div><br></div><div><div><br></div><div>------------</div><div><div>cmake_minimum_required(VERSION 3.10)</div><div><br></div><div>project(hellopetsc)</div><div>list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/hellopetsc)</div><div><br></div><div>SET(CMAKE_CXX_STANDARD 11)</div><div>SET(CMAKE_C_COMPILER mpicc)</div><div>SET(CMAKE_CXX_COMPILER mpicxx)</div><div><br></div><div>SET (PETSC_ARCH "arch-linux2-c-debug")</div><div><br></div><div>find_package(PETSc COMPONENTS CXX)</div><div><br></div><div>add_executable(hellopetsc main.cpp)</div></div><div>-------------</div><div><div>/home/evan/opt/clion-2018.1.2/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hellopetsc</div><div>CMake Error at FindPETSc.cmake:179 (include):</div><div>  include could not find load file:</div><div><br></div><div>    ResolveCompilerPaths</div><div>Call Stack (most recent call first):</div><div>  CMakeLists.txt:12 (find_package)</div><div><br></div><div><br></div><div>CMake Error at FindPETSc.cmake:181 (resolve_includes):</div><div>  Unknown CMake command "resolve_includes".</div><div>Call Stack (most recent call first):</div><div>  CMakeLists.txt:12 (find_package)</div><div><br></div><div><br></div><div>-- Configuring incomplete, errors occurred!</div><div>See also "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeOutput.log".</div><div>See also "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeError.log".</div><div><br></div><div>[Finished]</div></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 3:10 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> writes:<br>
<br>
> Matt and Jed,<br>
><br>
> Thanks for your comments.<br>
><br>
> I still have a trouble in using FindPETSc.cmake. I removed the directory:<br>
> (i.e. canceling cp - r /home/evan/petsc//lib/petsc/<br>
</span>> conf/rules /home/evan/petsc//lib/petsc/<wbr>conf/petscrules) and explicitly set<br>
<span class="">> SET (PETSC_ARCH "arch-linux2-c-debug all").<br>
<br>
</span>No " all".<br>
<div><div class="h5"><br>
> Now, FindPETSc.cmake does not recognize PETSC_DIR and PETSC_ARCH. When I<br>
> read the comments inside FindPETSc.cmake, the twos should be refined by<br>
> FindPETSc.cmake. BTW, I have my petsc at /home/evan/petsc. So all are<br>
> defaults.<br>
><br>
> Thanks for your kind help.<br>
><br>
> Evan<br>
><br>
> --------------<br>
> cmake_minimum_required(VERSION 3.10)<br>
><br>
> project(hellopetsc)<br>
> list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/<wbr>hellopetsc)<br>
><br>
> SET(CMAKE_CXX_STANDARD 11)<br>
> SET(CMAKE_C_COMPILER mpicc)<br>
> SET(CMAKE_CXX_COMPILER mpicxx)<br>
><br>
> SET (PETSC_ARCH "arch-linux2-c-debug all")<br>
><br>
> find_package(PETSc COMPONENTS CXX)<br>
><br>
> add_executable(hellopetsc main.cpp)<br>
> --------------<br>
> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug<br>
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc<br>
> CMake Error at FindPETSc.cmake:140 (message):<br>
>   The pair PETSC_DIR=/home/evan/petsc PETSC_ARCH=arch-linux2-c-debug all do<br>
>   not specify a valid PETSc installation<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:12 (find_package)<br>
><br>
><br>
> -- PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH.<br>
> (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (found<br>
> version "3.9.1")<br>
> -- Configuring incomplete, errors occurred!<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeOutput.log".<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeError.log".<br>
><br>
> [Finished]<br>
> --------------<br>
><br>
><br>
> On Fri, May 11, 2018 at 2:13 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
><br>
>> On Fri, May 11, 2018 at 5:06 PM, Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> wrote:<br>
>><br>
>>> Hi Jed,<br>
>>><br>
>>> Thanks for the comment. I added the module but still saw errors (before I<br>
>>> arrived here, I had to do cp - r /home/evan/petsc//lib/petsc/<br>
</div></div>>>> conf/rules /home/evan/petsc//lib/petsc/<wbr>conf/petscrules).<br>
<div><div class="h5">>>><br>
>><br>
>> That is wrong. It means PETSC_ARCH is (null) instead of the correct string.<br>
>><br>
>>    Matt<br>
>><br>
>><br>
>>> They are supposed to be defined by FindPETSc.cmake. How could I solve<br>
>>> these errors?<br>
>>><br>
>>> Could you also explain a little bit about how to use pkg-config to find<br>
>>> PETSc? Thanks!<br>
>>><br>
>>> Evan<br>
>>><br>
>>> ----------------<br>
>>> cmake_minimum_required(VERSION 3.10)<br>
>>><br>
>>> project(hellopetsc)<br>
>>> list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/<wbr>hellopetsc)<br>
>>><br>
>>> SET(CMAKE_CXX_STANDARD 11)<br>
>>> SET(CMAKE_C_COMPILER mpicc)<br>
>>> SET(CMAKE_CXX_COMPILER mpicxx)<br>
>>><br>
>>> find_package(PETSc COMPONENTS CXX)<br>
>>><br>
>>> add_executable(hellopetsc main.cpp)<br>
>>> -----------------<br>
>>><br>
>>> -----------------<br>
>>> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake<br>
>>> -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles"<br>
>>> /home/evan/CLionProjects/<wbr>hellopetsc<br>
>>> -- PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH.<br>
>>> (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (found<br>
>>> version "3.9.1")<br>
>>> -- Configuring done<br>
>>> -- Generating done<br>
>>> -- Build files have been written to: /home/evan/CLionProjects/hello<br>
>>> petsc/cmake-build-debug<br>
>>><br>
>>> [Finished]<br>
>>> -----------------<br>
>>><br>
>>><br>
>>> On Fri, May 11, 2018 at 12:08 PM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
>>><br>
>>>> Yes, it depends on this module from the same repository.<br>
>>>><br>
>>>> Note that you can use pkg-config to find PETSc these days.<br>
>>>><br>
>>>> Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> writes:<br>
>>>><br>
>>>> > Hi Stefano,<br>
>>>> ><br>
>>>> > Thanks for your comment. Now, cmake was able to locate FindPETSc.cmake<br>
>>>> file<br>
>>>> > in my project directory, but I see a new error.<br>
>>>> ><br>
>>>> > Evan<br>
>>>> ><br>
>>>> ><br>
>>>> > Messages<br>
>>>> > ------------------------------<wbr>----------------<br>
>>>> > /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake<br>
>>>> -DCMAKE_BUILD_TYPE=Debug<br>
>>>> > -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc<br>
>>>> > CMake Error at FindPETSc.cmake:123 (include):<br>
>>>> >   include could not find load file:<br>
>>>> ><br>
>>>> >     FindPackageMultipass<br>
>>>> > Call Stack (most recent call first):<br>
>>>> >   CMakeLists.txt:10 (find_package)<br>
>>>> ><br>
>>>> ><br>
>>>> > CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>>>> >   Unknown CMake command "find_package_multipass".<br>
>>>> > Call Stack (most recent call first):<br>
>>>> >   CMakeLists.txt:10 (find_package)<br>
>>>> ><br>
>>>> ><br>
>>>> > -- Configuring incomplete, errors occurred!<br>
>>>> > See also<br>
</div></div><span class="">>>>> > "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMake<br>
>>>> Files/CMakeOutput.log".<br>
>>>> > See also<br>
>>>> > "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMake<br>
</span><span class="">>>>> Files/CMakeError.log".<br>
>>>> > ------------------------------<wbr>----------------<br>
>>>> ><br>
>>>> > CMakeLists.txt<br>
>>>> > ------------------------------<wbr>----------------<br>
>>>> > /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake<br>
>>>> -DCMAKE_BUILD_TYPE=Debug<br>
>>>> > -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc<br>
>>>> > CMake Error at FindPETSc.cmake:123 (include):<br>
>>>> >   include could not find load file:<br>
>>>> ><br>
>>>> >     FindPackageMultipass<br>
>>>> > Call Stack (most recent call first):<br>
>>>> >   CMakeLists.txt:10 (find_package)<br>
>>>> ><br>
>>>> ><br>
>>>> > CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>>>> >   Unknown CMake command "find_package_multipass".<br>
>>>> > Call Stack (most recent call first):<br>
>>>> >   CMakeLists.txt:10 (find_package)<br>
>>>> ><br>
>>>> ><br>
>>>> > -- Configuring incomplete, errors occurred!<br>
>>>> > See also<br>
</span><span class="">>>>> > "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMake<br>
>>>> Files/CMakeOutput.log".<br>
>>>> > See also<br>
>>>> > "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMake<br>
</span><div><div class="h5">>>>> Files/CMakeError.log".<br>
>>>> ><br>
>>>> > [Finished]<br>
>>>> ><br>
>>>> ><br>
>>>> ><br>
>>>> > On Fri, May 11, 2018 at 11:34 AM, Stefano Zampini <<br>
>>>> <a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a><br>
>>>> >> wrote:<br>
>>>> ><br>
>>>> >> CMAKE is case sensitive on this. You should use find_package(PETSc ….)<br>
>>>> >><br>
>>>> >><br>
>>>> >> > On May 11, 2018, at 9:28 PM, Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> wrote:<br>
>>>> >> ><br>
>>>> >> > Hi,<br>
>>>> >> ><br>
>>>> >> > I would like to ask a question about FindPETSc.cmake. I place the<br>
>>>> cmake<br>
>>>> >> file in the same directory where main.cpp is placed. I also placed<br>
>>>> the file<br>
>>>> >> in /usr/share/cmake_xx/Modules.<br>
>>>> >><br>
>>>> >> Actually, it can be put in any directory pointed by the variable<br>
>>>> >> CMAKE_MODULE_PATH. If I were you, I would not modify /usr/share/<br>
>>>> >><br>
>>>> >> > Where should i put the file? What else should I do to use the file<br>
>>>> in<br>
>>>> >> cmake? Do I need any other lines in my cmakelists.txt except<br>
>>>> >> find_package(petsc)? Thanks for your comments.<br>
>>>> >> ><br>
>>>> >> > Evan<br>
>>>> >> ><br>
>>>> >> > ------------------------------<wbr>------------------------------<wbr>-<br>
>>>> >> ><br>
>>>> >> > cmake_minimum_required(VERSION 3.10)<br>
>>>> >> ><br>
>>>> >> > project(hellopetsc)<br>
>>>> >> ><br>
>>>> >> > SET(CMAKE_CXX_STANDARD 11)<br>
>>>> >> > SET(CMAKE_C_COMPILER mpicc)<br>
>>>> >> > SET(CMAKE_CXX_COMPILER mpicxx)<br>
>>>> >> ><br>
>>>> >> > find_package(PETSC COMPONENTS CXX)<br>
>>>> >> ><br>
>>>> >> > add_executable(hellopetsc main.cpp)<br>
>>>> >> ><br>
>>>> >> > ------------------------------<wbr>------------------------------<br>
>>>> >> > CMake Warning at CMakeLists.txt:9 (find_package):<br>
>>>> >> >   By not providing "FindPETSC.cmake" in CMAKE_MODULE_PATH this<br>
>>>> project<br>
>>>> >> has<br>
>>>> >> >   asked CMake to find a package configuration file provided by<br>
>>>> "PETSC",<br>
>>>> >> but<br>
>>>> >> >   CMake did not find one.<br>
>>>> >> ><br>
>>>> >> >   Could not find a package configuration file provided by "PETSC"<br>
>>>> with<br>
>>>> >> any of<br>
>>>> >> >   the following names:<br>
>>>> >> ><br>
>>>> >> >     PETSCConfig.cmake<br>
>>>> >> >     petsc-config.cmake<br>
>>>> >> ><br>
>>>> >> >   Add the installation prefix of "PETSC" to CMAKE_PREFIX_PATH or set<br>
>>>> >> >   "PETSC_DIR" to a directory containing one of the above files.  If<br>
>>>> >> "PETSC"<br>
>>>> >> >   provides a separate development package or SDK, be sure it has<br>
>>>> been<br>
>>>> >> >   installed.<br>
>>>> >><br>
>>>> >><br>
>>>><br>
>>><br>
>>><br>
>><br>
>><br>
>> --<br>
>> What most experimenters take for granted before they begin their<br>
>> experiments is infinitely more interesting than any results to which their<br>
>> experiments lead.<br>
>> -- Norbert Wiener<br>
>><br>
</div></div>>> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a> <<a href="http://www.caam.rice.edu/~mk51/" rel="noreferrer" target="_blank">http://www.caam.rice.edu/~<wbr>mk51/</a>><br>
>><br>
</blockquote></div><br></div>