<div dir="ltr">On Thu, May 16, 2013 at 11:22 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> writes:<br>
<br>
> ================================================================================<br>
> TEST check from config.libraries(/cygdrive/d/petsc-3.4.0/config/BuildSystem/config/libraries.py:145)<br>
> TESTING: check from config.libraries(config/BuildSystem/config/libraries.py:145)<br>
>   Checks that the library "libName" contains "funcs", and if it does defines HAVE_LIB"libName"<br>
>        - libDir may be a list of directories<br>
>        - libName may be a list of library names<br>
>               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'] []<br>

>                 Pushing language C<br>
> 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<br>

> 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<br>

> sh: conftest.c^M<br>
><br>
> Successful compile:<br>
> <<<<<<<<<<<<<br>
><br>
> Actually the libraries are found.<br>
<br>
I'm afraid I don't understand what happens here.  We look for and find<br>
MPI_Init in ../lib/amd64-msmpi.lib, then we look for MPI_Comm_create and<br>
compile with no warnings, then the link fails to produce the executable,<br>
but does not issue any warnings or error message:<br>
<br>
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<br>
/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<br>
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<br>
<br>
We interpret this as a successful link and move on to checking for<br>
includes.  This fails and now we try the next entry in the liblist?  The<br>
library can't possibly affect our ability to compile so the rest is just<br>
noise.  If we consider the library to be primary, we shouldn't fall back<br>
to others due to indirect failure like lack of includes.<br>
<br>
Should we change configureLibrary (below) to "lock in" the library once<br>
linking succeeds, then only iterate over includes?<br></blockquote><div><br></div><div style>I don't think this makes sense. A certain pair of library and include makes sense. Decoupling</div><div style>these invites all sorts of mismatches which would be hard to track down. I do not see what is</div>
<div style>wrong with the strategy above?</div><div style><br></div><div style>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It looks like we may need more ability to iterate over possible include<br>
paths anyway, in which case maybe generateGuesses should be split into<br>
one part that finds a library and another part that finds include paths?<br>
<br>
<br>
<br>
    for location, directory, lib, incl in self.generateGuesses():<br>
      if directory and not os.path.isdir(directory):<br>
        self.framework.logPrint('Directory does not exist: %s (while checking "%s" for "%r")' % (directory,location,lib))<br>
        continue<br>
      if lib == '': lib = []<br>
      elif not isinstance(lib, list): lib = [lib]<br>
      if incl == '': incl = []<br>
      elif not isinstance(incl, list): incl = [incl]<br>
      testedincl = list(incl)<br>
      # weed out duplicates when adding fincs<br>
      for loc in self.compilers.fincs:<br>
        if not loc in incl:<br>
          incl.append(loc)<br>
      if self.functions:<br>
        self.framework.logPrint('Checking for library in '+location+': '+str(lib))<br>
        if directory: self.framework.logPrint('Contents: '+str(os.listdir(directory)))<br>
      else:<br>
        self.framework.logPrint('Not checking for library in '+location+': '+str(lib)+' because no functions given to check for')<br>
      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}):<br>

        self.lib = lib<br>
        self.framework.logPrint('Checking for headers '+location+': '+str(incl))<br>
        if (not self.includes) or self.checkInclude(incl, self.includes, incls, timeout = 1800.0):<br>
          if self.includes:<br>
            self.include = testedincl<br>
          self.found     = 1<br>
          self.dlib      = self.lib+libs<br>
          if not hasattr(self.framework, 'packages'):<br>
            self.framework.packages = []<br>
          self.directory = directory<br>
          self.framework.packages.append(self)<br>
          return<br>
    if not self.lookforbydefault:<br>
      raise RuntimeError('Could not find a functional '+<a href="http://self.name" target="_blank">self.name</a>+'\n')<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>