[petsc-dev] petsc/master: unable to link in C++ with last night PETSC_WITH_EXTERNAL_LIB variable changes

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Mon Feb 12 11:53:03 CST 2018



On 12/02/18 12:11 PM, Jed Brown wrote:
> Eric Chamberland <Eric.Chamberland at giref.ulaval.ca> writes:
> 
>> why does mpi stuff appears in the first one and not the second?
>>
>> I would prefer to have "-lmpi" in the second one too... When is it
>> decided to "hide" external packages "under" PETSc? At configuration time?
> 
> I don't know what pkg-config recommends in this situation, but consider
> that petscsys.h includes mpi.h so a corresponding -I flag needs to be on
> the command line any time you compile code that calls PETSc.  If your
> application never calls MPI directly, it would be safe to link without
> -lmpi.
> 

ok, understood.  We do have MPI calls (C API).  I then have to add -lmpi 
myself and not rely on pkg-config of PETSC for this one and it is normal...

> Also note that PETSc provides symbols (like PETSC_COMM_WORLD) which also
> have the effect that merely calling PETSc does not require directly
> referencing MPI symbols (MPI_COMM_WORLD is a symbol, not a macro, in
> Open MPI).
> 
> And that PETSc built with MPICH can be linked unmodified with other
> conforming MPI implementations.
> 
>    http://www.mpich.org/abi/
> 

ok, that's interesting to know about!

I explicitly prohibited to execute with a different MPI lib/version than 
the one used to compile.  I could relax a bit this constraint then...

Thanks again,

Eric


More information about the petsc-dev mailing list