FindPETSc.cmake fails when PETSC_VERSION is not found
Trying to build FEniCS from source, Dolfin failed to build due to a configuration error:
-- Checking for one of the modules 'craypetsc_real;PETSc'
CMake Error at cmake/modules/FindPETSc.cmake:59 (string):
string sub-command REPLACE requires at least four arguments.
This eventually aborts the installation process.
Debugging it, this is due to PETSC_VERSION being empty in my system, while the code in lines 59-62 assumes that a meaningful PETSC_VERSION is always returned. This can be fixed by surrounding these lines with an "if" so that they run only when PETSC_FOUND:
# Extract major, minor, etc from version string
if (PETSC_FOUND)
string(REPLACE "." ";" VERSION_LIST ${PETSC_VERSION})
list(GET VERSION_LIST 0 PETSC_VERSION_MAJOR)
list(GET VERSION_LIST 1 PETSC_VERSION_MINOR)
list(GET VERSION_LIST 2 PETSC_VERSION_SUBMINOR)
endif()
At the very least, I managed to build dolfin this way on my gentoo system.
Comments (8)
-
-
reporter - changed version to 2016.1
-
reporter cmake version 3.5.2
dolfin-2016.1.0 (same for ffc, fiat, ufl, and dijitso, all installed from source with "pip install .")
I don't find a PETSc.pc file. Perhaps because there is no PETSc on my system. AFAIK it is an optional component and I want to build without it.
-
The line
-- Checking for one of the modules 'craypetsc_real;PETSc'
indicates that you must be using a dev version and not the 2016.1 release.I'll check that the new PETSc detection works properly when PETSc is not available.
-
-
assigned issue to
- changed version to dev
-
assigned issue to
-
reporter I'm using whatever was fetched by:
git clone https://bitbucket.org/fenics-project/dolfin/commits/tag/dolfin-2016.1.0
Never tried this particular build procedure, so maybe I'm missing something :-)
-
That will actually give you the latest
master
. Use this instead if you want to checkout thedolfin-2016.1.0
tag:git clone https://bitbucket.org/fenics-project/dolfin.git git checkout dolfin-2016.1.0
-
- changed status to resolved
Fix PETSc/SLEPc detection when PETSc/SLEPc are not available. Fixes
#777.→ <<cset 897f0457a6fd>>
- Log in to comment
Please send:
PETSc.pc
file