[petsc-dev] Why do we pass -L/usr/lib ?

Satish Balay balay at mcs.anl.gov
Thu Nov 6 16:14:02 CST 2014


On Thu, 6 Nov 2014, Jed Brown wrote:

> Satish Balay <balay at mcs.anl.gov> writes:
> 
> > I don't think we (configure) can easily deal with multiple copies of libraries.
> >
> > /usr/lib doesn't matter. It could be /foo/bar and /abc/xyz/. Its
> > possible for configure to test for package 'a' in the first location -
> > and test for package 'b' in the second location - but when the link
> > line is assembled - one of the packages from the wrong location can be
> > picked up.
> 
> I'm aware of that; I'm complaining about the order-dependence.  In this
> case, I would get a correct build if all the -L options were removed
> (because with these mpicc wrappers, /opt/mpich/lib/ is searched before
> /usr/lib/).  I'm afraid I don't know how to test for this and passing
> /opt/mpich/lib/libparmetis.so /usr/lib/libmetis.so ... is not a solution
> because it just defers link resolution to the ordering of rpath
> processing.


I presume you want configure to detect/remove -L/usr/lib from all
tests and final link line assembled by configure?

But if you have the good one (libfoo.a) in /usr/lib - and the bad one
in /opt/mpich/lib [and you wanted to pick up the good one] - then it
will still be broken.

> 
> > And wrt --with-package-dir=/usr - if thats what the user wants to do
> > [and not rely on compiler default search paths using --with-package=1
> > option] - we should respect that.. [and present errors if they occur].
> 
> Configure never even tries linking -lmetis.

I assumed wrong here. Perhaps we need the following change:

-------------------
$ git diff |cat
diff --git a/config/BuildSystem/config/package.py b/config/BuildSystem/config/package.py
index 7f7cd3c..342ada6 100644
--- a/config/BuildSystem/config/package.py
+++ b/config/BuildSystem/config/package.py
@@ -220,7 +220,8 @@ class Package(config.base.Configure):
   externalPackagesDir = property(getExternalPackagesDir, setExternalPackagesDir, doc = 'The directory for downloaded packages')

   def getSearchDirectories(self):
   -    '''By default, do not search any particular directories'''
   +    '''By default, do not search any particular directories - but do check default compiler location'''
   +    yield ''
        return []

   def getInstallDir(self):

---------------------

The alternative is:

--with-metis-lib="-lmetis" [but then --with-metis-include would also be requred by configure?]

Satish



More information about the petsc-dev mailing list