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

Jed Brown jed at jedbrown.org
Sat Feb 10 11:38:23 CST 2018


Éric Chamberland <Eric.Chamberland at giref.ulaval.ca> writes:

> Hi Matthew,
>
> Yes, I heard that the MPI C++ API has been deprecated.
>
> Yes, the mpi_cxx is now missing.  Our link line is formed mainly with 
> PETSC_WITH_EXTERNAL_LIB variable that is now:
>
> PETSC_WITH_EXTERNAL_LIB = -L/opt/petsc-master_debug/lib 
> -Wl,-rpath,/opt/petsc-master_debug/lib -L/opt/petsc-master_debug/lib 
> -L/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64 
> -Wl,-rpath,/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64 
> -Wl,-rpath,/opt/openmpi-1.10.2/lib -L/opt/openmpi-1.10.2/lib 
> -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.8.5 
> -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 
> -Wl,-rpath,/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64 
> -L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64 
> -Wl,-rpath,/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64 
> -L/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64 
> -Wl,-rpath,/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4 
> -L/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4 -lpetsc 
> -lsuperlu -lsuperlu_dist -lHYPRE -lcmumps -ldmumps -lsmumps -lzmumps 
> -lmumps_common -lpord -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lml 
> -lumfpack -lklu -lcholmod -lbtf -lccolamd -lcolamd -lcamd -lamd 
> -lsuitesparseconfig -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread 
> -lmkl_blacs_intelmpi_lp64 -liomp5 -ldl -lpthread -lparmetis -lmetis 
> -lptesmumps -lptscotch -lptscotcherr -lesmumps -lscotch -lscotcherr -lm 
> -lX11 -lstdc++ -ldl -lmpi_usempi -lmpi_mpifh -lmpi -lgfortran -lm 
> -lgfortran -lm -lgcc_s -lquadmath -lpthread -lrt -lm -lpthread -lz 
> -lstdc++ -ldl
>
> We add some stuff to this (our own compiled libs), but nothing related 
> to MPI or PETSc since we used to rely on PETSC_WITH_EXTERNAL_LIB for all 
> our diffrement environments (think about different petsc version, MPI 
> libs and compilers: clang, icc, g++) and it used to work until yesterday 
> changes...
>
> As you can see in the diff, this "block" of libraries have been removed 
> from PETSC_WITH_EXTERNAL_LIB: (the -- is part of the diff output):
>
> --ldl
> --lmpi_cxx
> --lmpi
> --lstdc++
> --lm
> --lgcc_s
> --lpthread
>
> and into this block there was the "-lmpi_cxx" that we need...

The point is that if you are linking C++ code that calls the MPI C++
interface, then *you* should link with mpicxx or equivalent.

You should not depend on PETSc to provide anything but PETSc to your
application (so if you call other libraries that your configuration of
PETSc uses, you should take responsibility to link them explicitly; this
is important when using shared libraries).  But you should definitely
not depend on PETSc to provide your application with stuff that has been
REMOVED from MPI (more than five years ago) and that PETSc does not use.


More information about the petsc-dev mailing list