[petsc-dev] configure: generating guesses from liblist and includes

Matthew Knepley knepley at gmail.com
Thu May 16 11:32:02 CDT 2013


On Thu, May 16, 2013 at 11:22 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Satish Balay <balay at mcs.anl.gov> writes:
>
> >
> ================================================================================
> > TEST check from
> config.libraries(/cygdrive/d/petsc-3.4.0/config/BuildSystem/config/libraries.py:145)
> > TESTING: check from
> config.libraries(config/BuildSystem/config/libraries.py:145)
> >   Checks that the library "libName" contains "funcs", and if it does
> defines HAVE_LIB"libName"
> >        - libDir may be a list of directories
> >        - libName may be a list of library names
> >               Checking for function MPI_Init in library
> ['/cygdrive/c/Program Files/Microsoft HPC Pack
> 2012/lib/amd64/msmpifec.lib', '/cygdrive/c/Program Files/Microsoft HPC Pack
> 2012/lib/amd64/msmpi.lib'] []
> >                 Pushing language C
> > sh: /cygdrive/d/petsc-3.4.0/bin/win32fe/win32fe cl -c -o
> /tmp/petsc-tL1oq8/config.libraries/conftest.o
> -I/tmp/petsc-tL1oq8/config.compilers
> -I/tmp/petsc-tL1oq8/config.setCompilers -I/tmp/petsc-tL1oq8/config.headers
> -I/tmp/petsc-tL1oq8/PETSc.utilities.cacheDetails
> -I/tmp/petsc-tL1oq8/config.types
> -I/tmp/petsc-tL1oq8/PETSc.utilities.missing
> -I/tmp/petsc-tL1oq8/PETSc.utilities.scalarTypes
> -I/tmp/petsc-tL1oq8/config.functions -I/tmp/petsc-tL1oq8/config.libraries
>  -MT -wd4996 -Z7  /tmp/petsc-tL1oq8/config.libraries/conftest.c
> > Executing: /cygdrive/d/petsc-3.4.0/bin/win32fe/win32fe cl -c -o
> /tmp/petsc-tL1oq8/config.libraries/conftest.o
> -I/tmp/petsc-tL1oq8/config.compilers
> -I/tmp/petsc-tL1oq8/config.setCompilers -I/tmp/petsc-tL1oq8/config.headers
> -I/tmp/petsc-tL1oq8/PETSc.utilities.cacheDetails
> -I/tmp/petsc-tL1oq8/config.types
> -I/tmp/petsc-tL1oq8/PETSc.utilities.missing
> -I/tmp/petsc-tL1oq8/PETSc.utilities.scalarTypes
> -I/tmp/petsc-tL1oq8/config.functions -I/tmp/petsc-tL1oq8/config.libraries
>  -MT -wd4996 -Z7  /tmp/petsc-tL1oq8/config.libraries/conftest.c
> > sh: conftest.c^M
> >
> > Successful compile:
> > <<<<<<<<<<<<
> >
> > Actually the libraries are found.
>
> I'm afraid I don't understand what happens here.  We look for and find
> MPI_Init in ../lib/amd64-msmpi.lib, then we look for MPI_Comm_create and
> compile with no warnings, then the link fails to produce the executable,
> but does not issue any warnings or error message:
>
> Executing: /cygdrive/d/petsc-3.4.0/bin/win32fe/win32fe cl  -o
> /tmp/petsc-tL1oq8/config.libraries/conftest.exe    -MT -wd4996 -Z7
> /tmp/petsc-tL1oq8/config.libraries/conftest.o
> /cygdrive/c/Program\ Files/Microsoft\ HPC\ Pack\
> 2012/lib/amd64/msmpifec.lib /cygdrive/c/Program\ Files/Microsoft\ HPC\
> Pack\ 2012/lib/amd64/msmpi.lib Ws2_32.lib
> sh: LINK : C:\cygwin\tmp\PE236E~1\CONFIG~1.LIB\conftest.exe not found or
> not built by the last incremental link; performing full link
>
> We interpret this as a successful link and move on to checking for
> includes.  This fails and now we try the next entry in the liblist?  The
> library can't possibly affect our ability to compile so the rest is just
> noise.  If we consider the library to be primary, we shouldn't fall back
> to others due to indirect failure like lack of includes.
>
> Should we change configureLibrary (below) to "lock in" the library once
> linking succeeds, then only iterate over includes?
>

I don't think this makes sense. A certain pair of library and include makes
sense. Decoupling
these invites all sorts of mismatches which would be hard to track down. I
do not see what is
wrong with the strategy above?

   Matt


> It looks like we may need more ability to iterate over possible include
> paths anyway, in which case maybe generateGuesses should be split into
> one part that finds a library and another part that finds include paths?
>
>
>
>     for location, directory, lib, incl in self.generateGuesses():
>       if directory and not os.path.isdir(directory):
>         self.framework.logPrint('Directory does not exist: %s (while
> checking "%s" for "%r")' % (directory,location,lib))
>         continue
>       if lib == '': lib = []
>       elif not isinstance(lib, list): lib = [lib]
>       if incl == '': incl = []
>       elif not isinstance(incl, list): incl = [incl]
>       testedincl = list(incl)
>       # weed out duplicates when adding fincs
>       for loc in self.compilers.fincs:
>         if not loc in incl:
>           incl.append(loc)
>       if self.functions:
>         self.framework.logPrint('Checking for library in '+location+':
> '+str(lib))
>         if directory: self.framework.logPrint('Contents:
> '+str(os.listdir(directory)))
>       else:
>         self.framework.logPrint('Not checking for library in '+location+':
> '+str(lib)+' because no functions given to check for')
>       if self.executeTest(self.libraries.check,[lib,
> self.functions],{'otherLibs' : libs, 'fortranMangle' :
> self.functionsFortran, 'cxxMangle' : self.functionsCxx[0], 'prototype' :
> self.functionsCxx[1], 'call' : self.functionsCxx[2], 'cxxLink': self.cxx}):
>         self.lib = lib
>         self.framework.logPrint('Checking for headers '+location+':
> '+str(incl))
>         if (not self.includes) or self.checkInclude(incl, self.includes,
> incls, timeout = 1800.0):
>           if self.includes:
>             self.include = testedincl
>           self.found     = 1
>           self.dlib      = self.lib+libs
>           if not hasattr(self.framework, 'packages'):
>             self.framework.packages = []
>           self.directory = directory
>           self.framework.packages.append(self)
>           return
>     if not self.lookforbydefault:
>       raise RuntimeError('Could not find a functional '+self.name+'\n')
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130516/8b211eee/attachment.html>


More information about the petsc-dev mailing list