← Back to team overview

dolfin team mailing list archive

Re: More link problems

 

On Thu, Mar 13, 2008 at 11:26:53AM +0000, Garth N. Wells wrote:
> 
> 
> Åsmund Ødegård wrote:
> > 
> > 
> > On Thu, Mar 13, 2008 at 12:17 PM, Anders Logg <logg@xxxxxxxxx 
> > <mailto:logg@xxxxxxxxx>> wrote:
> > 
> >     On Wed, Mar 12, 2008 at 08:43:25PM +0100, Åsmund Ødegård wrote:
> >      > On Wed, Mar 12, 2008 at 6:56 PM, Anders Logg <logg@xxxxxxxxx
> >     <mailto:logg@xxxxxxxxx>> wrote:
> >      > >
> >      > > On Wed, Mar 12, 2008 at 11:48:19AM +0100, Johan Hake wrote:
> >      > >  > On Tuesday 11 March 2008 17:47:09 Matthew Knepley wrote:
> >      > [snip
> >      > >
> >      > >  Does PyDOLFIN work for anyone else with the new build system?
> >      > >
> >      >
> >      > import dolfin works just fine at least! I compile with both petsc and
> >      > umfpack enabled, fwiw.
> > 
> >     Where is your PETSc installation and did you add it to your
> >     LD_LIBRARY_PATH?
> > 
> > 
> > It's in non-standard places. And I add the lib-thing  (lib/arch) in 
> > LD_LIBRARY_PATH.
> >
> 
> I don't really like having to do this. Why can't we just get the compile 
> flags from PETSc as we did with the old build system? It's not uncommon 
> to have more than one version of PETSc installed, so I would rather just 
> set PETSC_DIR and be done.
> 
> Garth

I had a discussion about this with Åsmund who straightened out some
question marks.

We rely on pkg-config when building applications against DOLFIN, so
when a user calls

  pkg-config --libs dolfin

that should spit out all the libraries needed to build something
against DOLFIN.

In particular, when DOLFIN depends on PETSc, it should also spit out
all the libraries and paths needed for that to work.

Now, there are two ways to handle this in the pkg-config files.
One way is to do as we did before, which is to list all the PETSc
stuff in the dolfin.pc file. This becomes messy and not very
modular.

The other (right) way to handle this is to use the built-in support in
pkg-config to handle dependencies. If you look in the dolfin.pc file
generated by the new build system, it contains the following line:

  Libs: -L${libdir} -ldolfin

So, it just lists the DOLFIN part, nothing about PETSc.

But then there's also the following line:

  Requires: numpy-1 ufc-1 umfpack python-2 petsc gts boost libxml-2.0

This tells pkg-config that DOLFIN depends on all these other packages,
so to link something against DOLFIN, pkg-config should also look
(recursively) in the pkg-config files for these other packages and
concatenate the flags to get one big list of flags that contains
everything needed.

The reason this does not work is that the generated PETSc pkg-config
file does not get installed so pkg-config will never find the libs for
PETSc and add those.

The solution to this problem is to let the build system

1. Generate all the needed pkg-config files and put them somewhere
under /scons.

2. Then install all those files in $prefix/lib/pkgconfig (as specified
by the user) when running scons install.

I think Åsmund (or Johannes?) is working on 2?

-- 
Anders


Follow ups

References