GithubHelp home page GithubHelp logo

cmake-modules's People

Contributors

ckhroulev avatar gruenich avatar ihnorton avatar jedbrown avatar johnfettig avatar mdave avatar ptooley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmake-modules's Issues

Fortran headers have new location in PETSc 3.6

From PETSc 3.5 to 3.6 my Fortran code stopped compiling, even with the
updated FindPETSc.cmake. I figured out it was because the Fortran
headers moved from $PETSC_DIR/include/finclude to
$PETSC_DIR/include/petsc/finclude. Therefore any F90 code with a
statement like

#include <finclude/petscsys.h>

would need to be changed to

#include <petsc/finclude/petscsys.h>

in the source files which is a bit of work (hypothetically more for
people with bigger codes than mine) and breaks the source from working
with PETSc <=3.5. I attached a minimal example of a code that breaks
from the 3.5 to 3.6 PETSc update. Note: I found a work around by
changing the attached CMakeLists.txt by editing the line

include_directories(${PETSC_INCLUDES})

to become

include_directories("${PETSC_INCLUDES}/petsc" "${PETSC_INCLUDES}")

which works for both 3.5 and 3.6 without editing my F90 source files
by simply exhaustively putting all the options of where finclude might
be in the include path. While I am fine with this, I thought I'd post
something to draw attention to the issue if you want to change it. For
example, defining a PETSC_Fortran_INCLUDES variable in FindPETSc.cmake
that automatically points to the fincludes directory regardless of the
PETSc version would avoid the need for the above trick (though it does
work).

Here is the example: main.F90

PROGRAM main
#include <finclude/petscsys.h>
PetscInt :: i
END PROGRAM

and CMakeLists.txt


set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Where I have my FindPETSc.cmake

cmake_minimum_required` (VERSION 2.8.8)
project (HELLO)
enable_language (Fortran)

find_package(PETSc REQUIRED)
include_directories(${PETSC_INCLUDES})

find_package(MPI REQUIRED)
add_definitions(${MPI_Fortran_COMPILE_FLAGS})
include_directories(${MPI_Fortran_INCLUDE_PATH})
link_directories(${MPI_Fortran_LIBRARIES})

add_executable(main.x main.F90)
target_link_libraries(main.x ${PETSC_LIBRARIES}  ${MPI_Fortran_LIBRARIES})

FindNetCDF finds libnetcdf but not netcdf.mod

Pleas let me know if you can offer any advice on resolving the following problem:

I set up a small repository to learn how to use FindNetCDF. The repository has just two Fortran source files, only one of which depends on NetCDF as specified in a single use netcdf statement. An abbreviated transcript of my results using my repository's add-cmake-file branch follows:

$ git clone --recursive https://github.com/sourceryinstitute/learning-cmake-find.git
$ cd learning-cmake-find
$ git checkout add-cmake-file
$ mkdir build
$ cd build 
$ FC=gfortran cmake ..

-- Found NetCDF: /opt/local/lib/libnetcdf.dylib

$ make
Scanning dependencies of target io_routines
[ 50%] Building Fortran object
CMakeFiles/io_routines.dir/src/io_routines.f90.o
/Users/rouson/Code/learning-make-find/src/io_routines.f90:18:8:

     use netcdf
        1
Fatal Error: Can't open module file ‘netcdf.mod’ for reading at (1): No
such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/io_routines.dir/src/io_routines.f90.o] Error 1
make[1]: *** [CMakeFiles/io_routines.dir/all] Error 2
make: *** [all] Error 2

I used MacPorts on macOS Sierra to install netcdf and netcdf-fortran with the resulting installed files:

$ port contents netcdf
Port netcdf contains:
  /opt/local/bin/nc-config
  /opt/local/bin/nccopy
  /opt/local/bin/ncdump
  /opt/local/bin/ncgen
  /opt/local/bin/ncgen3
  /opt/local/include/netcdf.h
  /opt/local/include/netcdf_mem.h
  /opt/local/include/netcdf_meta.h
  /opt/local/lib/cmake/netCDF/netCDFConfig.cmake
  /opt/local/lib/cmake/netCDF/netCDFConfigVersion.cmake
  /opt/local/lib/cmake/netCDF/netCDFTargets-release.cmake
  /opt/local/lib/cmake/netCDF/netCDFTargets.cmake
  /opt/local/lib/libnetcdf.11.3.0.dylib
  /opt/local/lib/libnetcdf.11.dylib
  /opt/local/lib/libnetcdf.dylib
  /opt/local/lib/libnetcdf.settings
  /opt/local/lib/pkgconfig/netcdf.pc
  /opt/local/share/man/man1/nccopy.1.gz
  /opt/local/share/man/man1/ncdump.1.gz
  /opt/local/share/man/man1/ncgen.1.gz
  /opt/local/share/man/man1/ncgen3.1.gz
  /opt/local/share/man/man3/netcdf.3.gz

$ port contents netcdf-fortran
Port netcdf-fortran contains:
  /opt/local/bin/nf-config
  /opt/local/include/netcdf.inc
  /opt/local/include/netcdf.mod
  /opt/local/include/netcdf4_f03.mod
  /opt/local/include/netcdf4_nc_interfaces.mod
  /opt/local/include/netcdf4_nf_interfaces.mod
  /opt/local/include/netcdf_f03.mod
  /opt/local/include/netcdf_fortv2_c_interfaces.mod
  /opt/local/include/netcdf_nc_data.mod
  /opt/local/include/netcdf_nc_interfaces.mod
  /opt/local/include/netcdf_nf_data.mod
  /opt/local/include/netcdf_nf_interfaces.mod
  /opt/local/include/typesizes.mod
  /opt/local/lib/libnetcdff.6.dylib
  /opt/local/lib/libnetcdff.a
  /opt/local/lib/libnetcdff.dylib
  /opt/local/lib/pkgconfig/netcdf-fortran.pc
  /opt/local/share/man/man3/netcdf_fortran.3.gz

Find PETSc fails

I'm trying to use the CMake module to find the PETSc installation that I built on Ubuntu 19.04. I am setting both environment and CMake variables for PETSC_DIR and PETSC_ARCH but I still get the following error message:

-- PETSC_DIR: /petsc
-- PETSC_ARCH: mpi-real-double
CMake Error at /usr/share/cmake-3.13/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) (found
  version "3.11.1")

Any ideas?

How to use FindPETSc.cmake?

Hello, I have copied the FindPETSc.cmake to /usr/share/cmake-3.7/Modules (where all the other .cmake files are). However, when I run cmake the following message is shown:

" By not providing "FindPETSC.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PETSC", but
CMake did not find one. "

This is how FindPETSc.cmake is called in my top level CMakeLists:
find_package(PETSC)
if(PETSC_FOUND)
include_directories(${PETSC_INCLUDE_DIR})
add_definitions( "-DHAS_PETSC" )
endif()

Could you please provide more information?

Thank you.

Can't find a working PETSc

I tried to use the installed petsc (3.1) and one I compiled from source (3.6) but I can't get them to work. In both cases I get

-- 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
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed
-- Performing Test MULTIPASS_TEST_4_petsc_works_all
-- Performing Test MULTIPASS_TEST_4_petsc_works_all - Failed
-- PETSc could not be used, maybe the install is broken.

I am able to compile and run the examples in the petsc source.

Use PETSc MPIEXEC for doing tests in FindPETSc.cmake?

On a machine like Summit at ORNL, executables built for the compute nodes need to be invoked via jsrun. I can get the tests that ship with PETSc to work by specifying --with-mpiexec=jsrun -a 1 -c 1 -g 1 at configure time. I'm wondering if it might be a good idea to have the tests that are run by the FindPETSc.cmake module use the MPIEXEC that is specified in the PETSc configuration. This should allow the FindPETSc module to work on Summit, instead of having to force PETSC_EXECUTABLE_RUNS to ON.

I haven't written any CMake code in ten years and I don't remember how to do anything, so I don't know how hard it is to get CMake to grab the right things from the PETSc configuration or whether there might be some good reason to not want to do this.

Update: I'm messing with FindPETSc.cmake because a project I'm working on uses that. I now see that @jedbrown's cmake-modules README states that we should probably be using FindPkgConfig instead. I have not used this and don't know if it makes the above issue moot, or if it will run into the same issue. (Does it need to run anything?)

PETSC_ARCH and missing "/conf/PETScConfig.cmake")

hi -

I am compiling a software (gridpack) which depends on petsc. spack install petsc installs fine, but doesn't seem to have PETSC_ARCH set. The following messages suggests it is expecting another file: "${PETSC_DIR}/${PETSC_ARCH}/conf/PETScConfig.cmake")

that I am not sure of its origin ... is there anything I am missing here?

Thanks

-- Checking PETSc ...
CMake Error at /home/ubuntu/GridPACK/cmake-jedbrown/FindPETSc.cmake:151 (message):
  The pair
  PETSC_DIR=/home/ubuntu/spack/opt/spack/linux-ubuntu20.04-haswell/gcc-9.3.0/petsc-3.13.4-2bjevskgval6putbionc5ehmxeidsvnn
  PETSC_ARCH= do not specify a valid PETSc installation
Call Stack (most recent call first):
  CMakeLists.txt:280 (find_package)


-- Using PETSc version 3.13.4
CMake Error at CMakeLists.txt:290 (message):
  PETSc found, but CMake configuration for PETSc installation not found?

FindPETSc: failure on PETSC_ARCH with ^ character

I have a petsc build on OSX with PETSC_ARCH=gcc-9.2.0^openmpi-3.1.1. The '^' character in the folder name seems to cause a call to echo in ${petsc_config_makefile} return bad data. Investigating a little more, it seems the behavior of 'echo' is notoriously non-portable, especially when used with flags and variables that contain dashes.

Problem in FindPETSc.cmake Line 159:
\t-@echo -n ${${VARIABLE}}

Proposed solution:
\t-@printf '%s' ${${VARIABLE}}

The proposed solution solves my build error, I just wasn't sure if it would cause any issues with other build configurations.

CMake ERROR: PETSC could not be found

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?
Note: my os is ubuntu 18.04

Use netcdf statement in Fortran

Hi,
I want to read a netcdf file using Fortran 90 and compling with gfortran. I'm seeing this error . Fatal error: can't open module file 'netcdf.mod' for reading at (1): no such file or directory
I compiled using
gfortran firstread.f90 -o first.x
My source code looks like
Program first read
Use netcdf
Implicit none
Character (len=*), parameter :: f_name= " pr_historical.nc"
Integer , parameter:: ndim=3, nlats=201, nlon=194
......
....
end program firstread.
Thanks

Unexpected configuration

Hello,
cmake tells me

-- petsc_lib_dir /home/florian/software/petsc/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 - Failed
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Success
-- PETSc requires extra include paths, but links correctly with only interface libraries.  This is an unexpected configuration (but it seems to work fine).
-- Found PETSc: /home/florian/software/petsc/include;/home/florian/software/petsc/arch-linux2-c-debug/include;/opt/mpich/include (found suitable version "3.8.4", minimum required is "3.6")

I use it like

find_package(PETSc 3.6 REQUIRED)
include_directories(${PETSC_INCLUDES})

add_library(mylib ${sourcesAllNoMain})
target_link_libraries(mylib PUBLIC ${PETSC_LIBRARIES})

Is there something I should or can do about that? I compiled petsc from source using the git maint branch.

Best Thanks!

PETSc not discovered with empty PETSC_ARCH

The fix of 2e65c1c to allow an absent PETSC_ARCH does not seem to work. From a bit of debugging it looks like that foreach (arch ${_petsc_arches}) skips over empty strings. Thus it does not try to the empty version of PETSC_ARCH.

As fix I have tried adding

  if (NOT PETSC_ARCH)
    message (STATUS "Trying without PETSC_ARCH")
    find_path (petscconf petscconf.h
      HINTS ${PETSC_DIR}
      PATH_SUFFIXES include bmake
      NO_DEFAULT_PATH)
    if (petscconf)
      message (STATUS "Install without PETSC_ARCH found")
      set (PETSC_ARCH "" CACHE STRING "PETSc build architecture")
      set (PETSC_ARCH "")
    endif (petscconf)
  endif (NOT PETSC_ARCH)
  set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)

after the foreach loop that tries to detect the PETSC_ARCH.

This fortunately fixes the problems on my system, though with my minimal knowledge of CMake I am far from sure if this is a/the correct solution to the problem. I have already noticed two things:

  • The line set (PETSC_ARCH "") is needed, otherwise PETSC_ARCH will remain at NOT_FOUND
  • Every time I run cmake again it will try to rediscover the PETSC_ARCH. I guess this happens due to that the check if discovery is needed (if (PETSC_DIR AND NOT PETSC_ARCH) on line 100) will be always be false on a system where PETSC_ARCH is empty.

P.S.
The system is a standard Arch Linux, where PETSc is installed using the AUR. Thus it is located in /opt/petsc/linux-c-opt/, with PETSC_DIR=/opt/petsc/linux-c-opt/ and no PETSC_ARCH set.

PETSC_VERSION not set when cmake run second time

Hello,

I have

find_package(PETSc 3.6 REQUIRED)
add_definitions(-DPETSC_MAJOR=${PETSC_VERSION_MAJOR} -DPETSC_MINOR=${PETSC_VERSION_MINOR})
message("PETSC VERSION: " ${PETSC_VERSION} )
message("PETSC VERSION: " ${PETSC_VERSION_MAJOR} " . " ${PETSC_VERSION_MINOR} )

To use some conditional compiling based on the PETSc version. (if there is a better way, let me know please!)

It works fine when cmake is ran on an empty directory:

% cmake ../..
[...]
-- petsc_lib_dir /home/florian/software/petsc/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 - Failed
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Success
-- PETSc requires extra include paths, but links correctly with only interface libraries.  This is an unexpected configuration (but it seems to work fine).
-- Found PETSc: /home/florian/software/petsc/include;/home/florian/software/petsc/arch-linux2-c-debug/include;/opt/mpich/include (found suitable version "3.8.4", minimum required is "3.6")
PETSC VERSION: 3.8.4
PETSC VERSION: 3 . 8

The define is also set correctly. But when I run the same command a second time

% cmake ../..
-- Build configuration: Debug
-- Special platform settings: none
-- Found PETSc: /home/florian/software/petsc/include;/home/florian/software/petsc/arch-linux2-c-debug/include;/opt/mpich/include (Required is at least version "3.6")
PETSC VERSION:
PETSC VERSION:  .

The values are empty. Also the defines for the following make are set to empty values.

Not really sure, if that is a problem of my config, or cmake or the module...

Thanks!

Package should fail if minimum version is not met

I included your FindPETSc.cmake and dependencies and made it work.

However, when specifiying a required version, the module does not fail when the version requirement is not met. I use the git maint branch, i.e. my version is 3.8.1. according to petscversion.h.

find_package (PETSc 3.20 REQUIRED) gives output:

-- petsc_lib_dir /home/floli/software/petsc/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 - 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
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Success
-- PETSc only need minimal includes, but requires explicit linking to all dependencies.  This is expected when PETSc is built with static libraries.
-- Found PETSc: /home/florian/software/petsc/arch-linux2-c-debug/include;/home/florian/software/petsc/include (Required is at least version "3.20")

The FindBoost.cmake, that is shipped with CMake, fails if the required version is not met. I think this package should do so, too.

Find.PETSc for LANGUAGES CXX

Having
project(preCICE LANGUAGES CXX C) at the top of my CMakeLists.txt, find_package(PETSc 3.6 REQUIRED) works fine.

However, when I omit the C language, it fails. I am not entirely sure, if this is a bug, but since PETSc is used without problems inside this C++ only project, imho it should not need the C language flag.

Thanks!

Error is:

-- The CXX compiler identification is GNU 7.2.0
-- 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
-- Build configuration: Debug
-- Special platform settings: none
-- petsc_lib_dir /home/floli/software/petsc/arch-linux2-c-debug/lib
-- Recognized PETSc install with single library for all packages
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal
CMake Error at /usr/share/cmake-3.9/Modules/CheckCSourceRuns.cmake:52 (try_run):
  Unknown extension ".c" for file

    /home/floli/precice/build/cmake-debug/CMakeFiles/CMakeTmp/src.c

  try_compile() works only for enabled languages.  Currently these are:

    CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  cmake-modules/FindPackageMultipass.cmake:97 (check_c_source_runs)
  cmake-modules/FindPETSc.cmake:269 (multipass_source_runs)
  cmake-modules/FindPETSc.cmake:282 (petsc_test_runs)
  CMakeLists.txt:30 (find_package)


-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Failed
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes
CMake Error at /usr/share/cmake-3.9/Modules/CheckCSourceRuns.cmake:52 (try_run):
  Unknown extension ".c" for file

    /home/floli/precice/build/cmake-debug/CMakeFiles/CMakeTmp/src.c

  try_compile() works only for enabled languages.  Currently these are:

    CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  cmake-modules/FindPackageMultipass.cmake:97 (check_c_source_runs)
  cmake-modules/FindPETSc.cmake:269 (multipass_source_runs)
  cmake-modules/FindPETSc.cmake:287 (petsc_test_runs)
  CMakeLists.txt:30 (find_package)


-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Failed
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries
CMake Error at /usr/share/cmake-3.9/Modules/CheckCSourceRuns.cmake:52 (try_run):
  Unknown extension ".c" for file

    /home/floli/precice/build/cmake-debug/CMakeFiles/CMakeTmp/src.c

  try_compile() works only for enabled languages.  Currently these are:

    CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  cmake-modules/FindPackageMultipass.cmake:97 (check_c_source_runs)
  cmake-modules/FindPETSc.cmake:269 (multipass_source_runs)
  cmake-modules/FindPETSc.cmake:296 (petsc_test_runs)
  CMakeLists.txt:30 (find_package)


-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed
-- Performing Test MULTIPASS_TEST_4_petsc_works_all
CMake Error at /usr/share/cmake-3.9/Modules/CheckCSourceRuns.cmake:52 (try_run):
  Unknown extension ".c" for file

    /home/floli/precice/build/cmake-debug/CMakeFiles/CMakeTmp/src.c

  try_compile() works only for enabled languages.  Currently these are:

    CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  cmake-modules/FindPackageMultipass.cmake:97 (check_c_source_runs)
  cmake-modules/FindPETSc.cmake:269 (multipass_source_runs)
  cmake-modules/FindPETSc.cmake:303 (petsc_test_runs)
  CMakeLists.txt:30 (find_package)


-- Performing Test MULTIPASS_TEST_4_petsc_works_all - Failed
-- PETSc could not be used, maybe the install is broken.
CMake Error at /usr/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH.
  (missing: PETSC_EXECUTABLE_RUNS) (found suitable version "3.8.1", minimum
  required is "3.6")
Call Stack (most recent call first):
  /usr/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  cmake-modules/FindPETSc.cmake:331 (find_package_handle_standard_args)
  CMakeLists.txt:30 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/floli/precice/build/cmake-debug/CMakeFiles/CMakeOutput.log".
See also "/home/floli/precice/build/cmake-debug/CMakeFiles/CMakeError.log".

Issue for FindPetsc.cmake on Ubuntu 16.04

Hello,
FindPETSc.cmake does not work on Ubuntu 16.04.
This is because the directory structure of /usr/lib/petscdir/3.6.2 does not correspond to a usual one (e.g. as on Ubuntu 14.04). The directory /usr/lib/petscdir/3.6.2 only contains a single directory, with the architecture as its name (e.g. linux-gnu-c-opt). It does not contain bin, conf, include, lib.

PETSc detection fails on fedora 32

From precice/precice#878

On a fedora:32 docker build, the detection of PETSc is not successfull.

$ dnf install -y ... petsc petsc-devel petsc-openmpi petsc-openmpi-devel

$ export PETSC_DIR=/usr/lib64/petsc
$ export PETSC_ARCH=linux-gnu
$ export PETSC_INCLUDES=/usr/include/petsc
$ export PETSC_LIBRARIES=/usr/lib64/petsc

# <--
# I think there is the reson of no detection.
# petsc directory structure is on fedora different to debain!
$ find /usr -name "petscversion.h"
/usr/include/openmpi-x86_64/petsc/petscversion.h
/usr/include/petsc/petscversion.h

$ cmake                                                                           \
  -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release                             \
  -DPRECICE_MPICommunication=ON                                                 \
  -DMPI_CXX_COMPILER=/usr/lib64/openmpi/bin/mpicxx                              \
  -DMPI_C_COMPILER=/usr/lib64/openmpi/bin/mpicc                                 \
  -DMPI_Fortran_COMPILER=/usr/lib64/openmpi/bin/mpifort                         \
  -DPRECICE_PETScMapping=on                                                    \
  ..
-- === CONFIGURATION ===
...
-- === DEPENDENCIES ===
-- Validating Eigen
-- Validating Prettyprint - success [cached]
-- Validating LibXml2
-- Validating Prettyprint - success [cached]
-- Validating JSON
-- Validating Prettyprint - success [cached]
-- Validating Prettyprint
-- Validating Prettyprint - success [cached]
-- MPI Version: Open MPI v4.0.4, package: Open MPI [email protected] Distribution, ident: 4.0.4, repo rev: v4.0.4, Jun 10, 2020
-- Checking for module 'PETSc>=3.12'
--   Package 'PETSc', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  Could NOT find PETSc (missing: PETSc_FOUND PETSc_INCLUDE_DIRS) (Required is
  at least version "3.12")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindPETSc.cmake:171 (find_package_handle_standard_args)
  CMakeLists.txt:216 (find_package)


-- Configuring incomplete, errors occurred!

Couldn't find petsc at the SuperMUC HPC system

Hello,

the petsc/3.8 module on the SuperMUC HPC system sets

setenv          PETSC_DIR       /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt
setenv          PETSC_ARCH      arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt
ls $PETSC_DIR
bin  include  lib  share

I am not sure if the environment is misconfigured or rather an edge case that should be fixed in FindPETSC.

Thanks!

cmake error on ubuntu when linking fortran project with petsc

Hi, I am trying to use cmake to compile our fortran project (don't ask why, I was to told to...), I am new to
cmake and I struggled days just to make mpi work..., now and I got the error as

" CMake Error at cmake-modules/FindPETSC.cmake:171 (resolve_includes):
Unknown CMake command "resolve_includes".
Call Stack (most recent call first):
CMakeLists.txt:117 (find_package)"

I add a directory cmake-modules to put the files CorrectWindowsPaths.cmake, FindPETSc.cmake, FindPackageMultipass.cmake and ResolveCompilerPaths.cmake which I have gotten from you.
and the following is my CMakeLists.txt on top level:

cmake_minimum_required (VERSION 2.6)
project (XXXX)
enable_language (Fortran CXX C)
find_package(MPI)
set(CMAKE_Fortran_COMPILE_FLAGS "${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}")
set(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}")
include_directories(SYSTEM ${MPI_Fortran_INCLUDE_PATH})
list (APPEND CMAKE_MODULE_PATH "./cmake-modules")
set (PETSC_DIR "/home/tjz/work/petsc-intel")
set (PETSC_ARCH "linux-gnu-gcc")
find_package(PETSC REQUIRED)
if(PETSC_FOUND)
message(STATUS "Found Petsc: ${PETSC_FOUND}" )
endif(PETSC_FOUND)

Could you please give me some help on solving this error, thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.