[petsc-dev] petsc/master: unable to link in C++ with last night PETSC_WITH_EXTERNAL_LIB variable changes
Jeff Hammond
jeff.science at gmail.com
Sat Feb 10 16:44:16 CST 2018
On Sat, Feb 10, 2018 at 1:48 PM, Jed Brown <jed at jedbrown.org> wrote:
> Éric Chamberland <Eric.Chamberland at giref.ulaval.ca> writes:
>
> > ok, let put our in-house code away, simply try this simple example:
> >
> > ----------
> >
> > #include <mpi.h>
> >
> > int main() {
> > /*empty!! let's see the .o */
> >
> > return 1;
> >
> > }
> > ---------
> >
> > then:
> >
> > g++ -c test.cc -I/opt/openmpi-1.10.2/include -o test.o
> >
> > nm -C test.o | grep "MPI::" | grep " U "
> >
> > U MPI::Win::Free()
> > U MPI::Comm::Comm()
> > U MPI::Datatype::Free()
> >
> > so: as soon you are compiling a c++ file with this openmpi 1.10.2 (even
> > if you use gcc -c test.cc -I/opt/openmpi-1.10.2/include -o test.o in my
> > example) it *requires* you to link with mpi_cxx lib...
>
> That's sad, but is this not avoided by defining OMPI_SKIP_MPICXX before
> including mpi.h? (There is also MPICH_SKIP_MPICXX if you want.) This
> is done by default in petscsys.h, but you might not include it in that
> file or don't include it before mpi.h is included.
>
Indeed, everybody should compiler MPI codes with "-DMPICH_SKIP_MPICXX=1
-DOMPI_SKIP_MPICXX=1" now.
I'll ask MPICH and Open-MPI to switch the default to exclude C++ bindings.
Jeff
--
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180210/11748676/attachment.html>
More information about the petsc-dev
mailing list