bitpit icon indicating copy to clipboard operation
bitpit copied to clipboard

CMake error: PETSC could not be found

Open JanssensNick opened this issue 5 years ago • 9 comments

Dear, When using ccmake to install bitpit, I get the following error:

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) Call Stack (most recent call first): /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) external/PETSc/cmake/FindPETSc.cmake:348 (find_package_handle_standard_args) CMakeLists.txt:524 (find_package)

However, I have set all environmental variables (PETSC_DIR, PETSC_ARCH, PETSC_INCLUDES, PETSC_LIBRARIES and PETSC_EXECUTABLE_RUNS). Does anybody know how to solve this?

JanssensNick avatar Nov 14 '19 11:11 JanssensNick

Hello Nick, we are glad to know about your interest in bitpit. About your problem, you should give us some more information. I'll try to guess:

  • did you install PETSc or you only build it? Please, install it and set PETSC_DIR and PETSC_ARCH according to your installation.
  • If you already install PETSc, please, verify that the values you are using in PETSC_DIR and PETSC_ARCH are the one suggested by PETSc after installation and that the path $PETSC_DIR/$PETSC_ARCH exists, a common installation leaves PETSC_ARCH empty.

If none of the guesses above solve the problem and you installed PETSc, please send us you PETSC_DIR and PETSC_ARCH values after installation, the PETSc configure.log and the file make.log (this file is in a subfolder of your build folder and this subfolder has the name of the value used for PETSC_ARCH during your building i.e. YOUR_BUILD_FOLDER/$PETSC_ARCH/lib/petsc/conf/make.log ).

I hope this can help you. Please, let us know.

Thanks,

Marco Cisternino, PhD [email protected]


OPTIMAD Engineering srl Via Giacinto Collegno 18, Torino, Italia. +3901119719782 www.optimad.it


Da: Nick Janssens [email protected] Inviato: giovedì 14 novembre 2019 12:52 A: optimad/bitpit Cc: Subscribed Oggetto: [optimad/bitpit] CMake error: PETSC could not be found (#23)

Dear, When using ccmake to install bitpit, I get the following error:

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) Call Stack (most recent call first): /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) external/PETSc/cmake/FindPETSc.cmake:348 (find_package_handle_standard_args) CMakeLists.txt:524 (find_package)

However, I have set all environmental variables (PETSC_DIR, PETSC_ARCH, PETSC_INCLUDES, PETSC_LIBRARIES and PETSC_EXECUTABLE_RUNS). Does anybody know how to solve this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/optimad/bitpit/issues/23?email_source=notifications&email_token=ABSMIGHT2L6VAIJZ7E7NPHDQTU3YXA5CNFSM4JNKKEEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HZJOB2Q, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABSMIGFJ4WKPIRUTTOVNZY3QTU3YXANCNFSM4JNKKEEA.

marcocisternino avatar Nov 14 '19 12:11 marcocisternino

Dear, Thank you very much for your answer! Regarding the first 2 remarks:

  • I've installed PETSc and I've set the variables PETSC_DIR and PETSC_ARCH as environmental variable, which I verified with echo:
    • PETSC_DIR = .../petsc-3.94 (the root folder of PETSC)
    • PETSC_ARCH = arch-linux2-c-debug and these are also the values that the installer suggested. However, when I run the ccmake command with the error from my previous post, I also see this: ccmakeError where the PETSC_DIR is not set anymore (even though I verified it that I set it as an environmental variable). I've also included the requested log files. configure.log make.log

Thank you very much in advance. Nick Janssens

JanssensNick avatar Nov 14 '19 15:11 JanssensNick

Dear Nick, your files contain only your path to the files, I need their original content in order to help you. Your variable values are quite weird: PETSC_DIR = .../petsc-3.94 ? What does it mean, please? I give you an example: $ echo $PETSC_DIR /opt/petsc/petsc-3.7.5

In PETSc configuration what do you set as prefix? If you didn't set it the default value is /usr/local. Therefore, echo $PETSC_DIR should answer either /usr/local or what you set as prefix. If you set "../petsc-3.94" as prefix, I hope you used 2 points and not 3, PETSc has been installed in the build folder parent folder. Probably, we can solve the problem if you send us the right configure.log and make.log.

Thanks,

Marco Cisternino

marcocisternino avatar Nov 15 '19 09:11 marcocisternino

Dear Marco Oops, I didn't notice that, the correct log files should now be attached: configure.log make.log

Concerning the variable values, .. was an abbreviation of the full path, so:

  • echo $PETSC_DIR: /home/nick/bitpit-bitpit-1.6.0/build/petsc-3.9.4
  • echo $PETSC_ARCH: arch-linux2-c-debug (I've installed my petsc directory in the bitpit build directory, this is not ideal but shouldn't be a problem, right?)

Maybe something else that can be useful: I've set the PETSC_DIR and PETSC_ARCH values as environmental variables in my .bashrc file after the installation of PETSC. If I did echo $PETSC_DIR right after the installation of PETSC, the variables were empty. This is why I manually set them in .bashrc.

Thank you in advance

Nick

JanssensNick avatar Nov 15 '19 14:11 JanssensNick

@JanssensNick : Hello, I experienced the same problem when trying to install bitpit, (You can check the closed issues). If I remember well, then you can proceed as follows: Below, I am using ccmake instead of CMake. In my case, bitpit doesn't detect the content of the variables PETSC_DIR and PETSC_ARCH so you must change them manually in ccmake (make sure that they are correct). That is, in ccmake, make sure that:

PETSC_DIR is /home/nick/bitpit-bitpit-1.6.0/build/petsc-3.9.4 PETSC_ARCH is arch-linux2-c-debug

After that I guess, you will get another error, about the variable PETSC_RUN_EXECUTABLES (I don't rememeber exactly). So in order to solve that, you need to run ccmake like this:

cmake .. -DPETSC_EXECUTABLE_RUNS=ON

s1291 avatar Nov 17 '19 20:11 s1291

Dear, Thank very much, this did the trick! However, now I am getting this error message: cmakeError which I don't quite understand. Any thoughts? I tried to set the path to my cmake executables like this: ccmakeErrorBis by setting the value in CMakeLists.txt, but the Path is not recognised. Nick

JanssensNick avatar Nov 18 '19 13:11 JanssensNick

@JanssensNick I think this is a CMake internal error, so:

  • First try to remove the build folder, close the terminal, and open a new one. Now try again to build bitpit (of course, follow the instructions above regarding PETSC_DIR and PETSC_ARCH.
  • If you still get the same error, please try to re-install your cmake. Then try to build bitpit.

s1291 avatar Nov 18 '19 16:11 s1291

I tried both suggestions, but they didn't work. Any other ideas?

JanssensNick avatar Nov 19 '19 07:11 JanssensNick

In top-level CMakeLists.txt (from current master branch), actually cmake variables PETSC_DIR and PETSC_ARCH are hardwired respectively to an empty string and "arch-linux2-c", which somehow short-circuits the job that should be done inside FindPETSc.cmake :

...
if (MODULE_LA_ENABLED)
    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/PETSc/cmake")

    set(PETSC_DIR "" CACHE PATH "Directory in which PETSc resides")
    set(PETSC_ARCH "arch-linux2-c" CACHE STRING "Build architecture")

    find_package(PETSc REQUIRED)

    list (APPEND BITPIT_EXTERNAL_DEPENDENCIES "PETSc")
    list (APPEND BITPIT_EXTERNAL_LIBRARIES "${PETSC_LIBRARIES}")
    list (APPEND BITPIT_EXTERNAL_INCLUDE_DIRS "${PETSC_INCLUDES}" )
endif()

Setting cmake variables PETSC_DIR and PETSC_VAR in top-level CMakeLists.txt completely shadows env variable with the same name, which are then never taken into account inside FindPETSc.cmake.

I suggest to first use values optionnal given in the cmake (or ccmake) configure command line and then check if the env variable were set, something like :


# create a cmake cache variable
set(PETSC_DIR "" CACHE PATH "Installation directory of PETSC library")

# if user gave value on the command line -DPETSC_DIR=/some/location/to/petsc it will be used
# then consider using the env. var. PETSC_DIR only if not already given through the CMake cache var.
if (NOT PETSC_DIR AND DEFINED ENV{PETSC_DIR})
  set(PETSC_DIR "$ENV{PETSC_DIR}")
  message(STATUS "PETSC_DIR found in environment : ${PETSC_DIR}")
endif() 

These checks should probably be done at the begining of the FindPETSc.cmake

pkestene avatar Jan 16 '20 21:01 pkestene