[petsc-dev] Requiring $prefix/lib for --with-pkg-dir=

Satish Balay balay at mcs.anl.gov
Thu May 28 17:09:41 CDT 2015


Here is my slightly modified change [to avoid checking '' twice]

Satish

-------

$ git diff |cat
diff --git a/config/BuildSystem/config/package.py b/config/BuildSystem/config/package.py
index 4ff326a..3993c05 100644
--- a/config/BuildSystem/config/package.py
+++ b/config/BuildSystem/config/package.py
@@ -320,9 +320,10 @@ class Package(config.base.Configure):
     return os.path.join(prefix, includeDir)
 
   def generateGuesses(self):
+    libdirs = list(set([self.libdir, self.altlibdir, '']))
     d = self.checkDownload()
     if d:
-      for libdir in [self.libdir, self.altlibdir]:
+      for libdir in libdirs:
         libdirpath = os.path.join(d, libdir)
         if not os.path.isdir(libdirpath):
           self.logPrint(self.PACKAGE+': Downloaded DirPath not found.. skipping: '+libdirpath)
@@ -358,7 +359,7 @@ class Package(config.base.Configure):
                            fakeExternalPackagesDir+' is reserved for --download-package scratch space. \n'+
                            'Do not install software in this location nor use software in this directory.')
 
-      for libdir in [self.libdir, self.altlibdir]:
+      for libdir in libdirs:
         libdirpath = os.path.join(d, libdir)
         if not os.path.isdir(libdirpath):
           self.logPrint(self.PACKAGE+': UserSpecified DirPath not found.. skipping: '+libdirpath)
@@ -405,7 +406,7 @@ class Package(config.base.Configure):
           self.logPrint(self.PACKAGE+': SearchDir DirPath not found.. skipping: '+d)
           continue
         includedir = self.getIncludeDirs(d, self.includedir)
-        for libdir in [self.libdir, self.altlibdir]:
+        for libdir in libdirs:
           libdirpath = os.path.join(d, libdir)
           if not os.path.isdir(libdirpath):
             self.logPrint(self.PACKAGE+': DirPath not found.. skipping: '+libdirpath)
diff --git a/config/BuildSystem/config/packages/MPI.py b/config/BuildSystem/config/packages/MPI.py
index 72da4cf..bcd621c 100644
--- a/config/BuildSystem/config/packages/MPI.py
+++ b/config/BuildSystem/config/packages/MPI.py
@@ -68,6 +68,7 @@ class Configure(config.package.Package):
   def generateLibList(self, directory):
     if self.setCompilers.usedMPICompilers:
       self.liblist = []
+      self.libdir  = []
     return config.package.Package.generateLibList(self,directory)
 
   # search many obscure locations for MPI


On Thu, 28 May 2015, Satish Balay wrote:

> Sorry - haven't checked on this - and replying late..
> 
> On Mon, 11 May 2015, Jed Brown wrote:
> 
> > Satish Balay <balay at mcs.anl.gov> writes:
> > 
> > > For one - I want to get rid of 'self.libdir,self.altlibdir' usage [but
> > > self.libdir is used allover configure - so I should look at this usage
> > > more closely before I make this change].
> > >
> > > But to adress your issue - I expected packages that don't have 'lib' to
> > > set: [as in config/BuildSystem/config/packages/cusp.py]
> > >
> > > self.libdir = ''.
> > >
> > > But to get libdir check working for mpicc etc - perhaps the following would
> > > suffice?
> > >
> > >>>>>>>>
> > > $ git diff config/BuildSystem/config/packages/MPI.py
> > > diff --git a/config/BuildSystem/config/packages/MPI.py b/config/BuildSystem/config/packages/MPI.py
> > > index 0a0cb2a..312de0c 100644
> > > --- a/config/BuildSystem/config/packages/MPI.py
> > > +++ b/config/BuildSystem/config/packages/MPI.py
> > > @@ -68,6 +68,7 @@ class Configure(config.package.Package):
> > >    def generateLibList(self, directory):
> > >      if self.setCompilers.usedMPICompilers:
> > >        self.liblist = []
> > > +      self.libdir  = []
> > >      return config.package.Package.generateLibList(self,directory)
> > >  
> > >    # search many obscure locations for MPI
> > > <<<<<<<<<
> > 
> > Why should MPI be special?
> 
> You mean wrt 'self.libdir = []' change? In that piece of code - we are
> using MPICompilers [and not a library]. So this is the way to indicate
> it. [similar to 'cusp.py' code thats already present]
> 
> > 
> > > To get this working more generally - perhaps the following change?
> > >
> > >>>>>>>>>
> > > $ git diff config/BuildSystem/config/package.py |cat
> > > diff --git a/config/BuildSystem/config/package.py b/config/BuildSystem/config/package.py
> > > index 4c1f2c4..7a7da1b 100644
> > > --- a/config/BuildSystem/config/package.py
> > > +++ b/config/BuildSystem/config/package.py
> > > @@ -322,7 +322,7 @@ class Package(config.base.Configure):
> > >    def generateGuesses(self):
> > >      d = self.checkDownload()
> > >      if d:
> > > -      for libdir in [self.libdir, self.altlibdir]:
> > > +      for libdir in [self.libdir, self.altlibdir, '']:
> > >          libdirpath = os.path.join(d, libdir)
> > >          if not os.path.isdir(libdirpath):
> > >            self.logPrint(self.PACKAGE+': Downloaded DirPath not found.. skipping: '+libdirpath)
> > > @@ -358,7 +358,7 @@ class Package(config.base.Configure):
> > >                             fakeExternalPackagesDir+' is reserved for --download-package scratch space. \n'+
> > >                             'Do not install software in this location nor use software in this directory.')
> > >  
> > > -      for libdir in [self.libdir, self.altlibdir]:
> > > +      for libdir in [self.libdir, self.altlibdir, '']:
> > >          libdirpath = os.path.join(d, libdir)
> > >          if not os.path.isdir(libdirpath):
> > >            self.logPrint(self.PACKAGE+': UserSpecified DirPath not found.. skipping: '+libdirpath)
> > > @@ -405,7 +405,7 @@ class Package(config.base.Configure):
> > >            self.logPrint(self.PACKAGE+': SearchDir DirPath not found.. skipping: '+d)
> > >            continue
> > >          includedir = self.getIncludeDirs(d, self.includedir)
> > > -        for libdir in [self.libdir, self.altlibdir]:
> > > +        for libdir in [self.libdir, self.altlibdir, '']:
> > >            libdirpath = os.path.join(d, libdir)
> > >            if not os.path.isdir(libdirpath):
> > >              self.logPrint(self.PACKAGE+': DirPath not found.. skipping: '+libdirpath)
> > > <<<<<<<<<<<<<
> > 
> > Was there a reason to check in the first place?
> 
> You mean - check for existance of the dir? Its an optimization to
> avoid numerous compilers [that would fail anyway] in configure.
> 
> > Having an explicit check for a $prefix/lib directory and then
> > circumventing the check just adds complexity.
> 
> I think its still a net gain - and reduces the number of compiles invoked.
> 
> And the check for libdir = '' is explicitly looking at default
> compiler paths. [so a more correct thingy - than a successful link
> test with a nonexistant path?]
> 
> At some point someone could rewrite this whole thing [with each
> package listing its posible libdir list] - but do you object to this
> change as a fix to the current code?
> 
> Satish
> 




More information about the petsc-dev mailing list