spack: Unable to build PETSc, PETSC_DIR already set

configure fails immediately if the PETSC_DIR environment variable is already set. Spack should unset this.

===============================================================================
             Configuring PETSc to compile on your system                       
===============================================================================
TESTING: configureExternalPackagesDir from config.framework(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/BuildSystem/config/framework.py:834)
TESTING: configureDebuggers from config.utilities.debuggers(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/BuildSystem/config/utilities/debuggers.py:22)
TESTING: configureGit from config.sourceControl(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/BuildSystem/config/sourceControl.py:24)
TESTING: configureMercurial from config.sourceControl(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/BuildSystem/config/sourceControl.py:35)
TESTING: configureCLanguage from PETSc.options.languages(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/PETSc/options/languages.py:27)
TESTING: configureDirectories from PETSc.options.petscdir(/scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4/config/PETSc/options/petscdir.py:23)
*******************************************************************************
         UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log for details):
-------------------------------------------------------------------------------
The environmental variable PETSC_DIR /home/ajstewart/petsc MUST be the current directory /scratch/ajstewart/spack-stage/spack-stage-sFRYcv/petsc-3.7.4
*******************************************************************************

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 33 (32 by maintainers)

Most upvoted comments

I would actually unset both PETSC_DIR and PETSC_ARCH during the install (in case the user had them previously set), they are not needed and if you do set PETSC_DIR it will look like there is a reason to set it confusing people who look at the code in the future.

For usage I would set the PETSC_DIR as it has always been done and unset PETSC_ARCH, again in case someone had it set before (PETSC_ARCH is only useful for installing without --prefix) and since spack always uses --prefix it should not be set.

@adamjstewart try in install (see above https://github.com/LLNL/spack/issues/2767#issuecomment-271030405)

        # set PETSC_DIR for installation
        # Note that one should set the current (temporary) directory instead
        # its symlink in spack/stage/ !
        os.environ['PETSC_DIR'] = os.getcwd()

this/similar is already done in SLEPC and does work.