[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible to build one Petsc that works for both C and C++?
- To: petsc-users@xxxxxxxxxxx
- Subject: Re: Is it possible to build one Petsc that works for both C and C++?
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Sun, 17 Jun 2007 11:11:32 -0500
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nsl2V2pAc42Nc8MjOAjkcuz19KivkRJXugeSn3HjCTnucRYKMpa3w0rKiYSQpzBqAQI4mip6PfQMvLLkvha7VyRqrnJbX6tckNjpfuusd+bQTw3H8Wsc5pwg1OJWO7GS/QaFG0WAW6VXDIQgRmc3gcgTTgJvZR9iJNpAdrFHveE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=M1n68z8M2eC8Eo12Tds3l+2gpL3MkgWKHTZqC6JJBVXYhZ0i73m797Z6UESGR8Z0zr9Ryud0+Uw0/eCajAY3zeGSgWhb9lIp8eMLM/DCL+Jjv2h8ipvg3KUSnaAYx7FuaxQrfvjnj7w1oMdTYmDY0XzmD83gxJ4Gj+JZ6y1797k=
- In-reply-to: <169129.20648.qm@web36208.mail.mud.yahoo.com>
- References: <a9f269830706170718tb32298fh9be27b87b945578d@mail.gmail.com> <169129.20648.qm@web36208.mail.mud.yahoo.com>
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
This is an MPICH problem. From mpicxx.h:
// There is a name conflict between stdio.h and the MPI C++ binding
// with respect to the names SEEK_SET, SEEK_CUR, and SEEK_END. MPI
// wants these in the MPI namespace, but stdio.h will #define these
// to integer values. #undef'ing these can cause obscure problems
// with other include files (such as iostream), so we instead use
// #error to indicate a fatal error. Users can either #undef
// the names before including mpi.h or include mpi.h *before* stdio.h
// or iostream.
#ifndef MPICH_IGNORE_CXX_SEEK
#ifdef SEEK_SET
#error "SEEK_SET is #defined but must not be for the C++ binding of MPI"
//#undef SEEK_SET
#endif
#ifdef SEEK_CUR
#error "SEEK_CUR is #defined but must not be for the C++ binding of MPI"
//#undef SEEK_CUR
#endif
#ifdef SEEK_END
//#undef SEEK_END
#error "SEEK_END is #defined but must not be for the C++ binding of MPI"
#endif
#endif
I recommend not including stdio.h yourself. PETSc will do it.
Matt
On 6/17/07, Shi Jin <jinzishuai@xxxxxxxxx> wrote:
But this is what I got trying to compile my C petsc
code with the C++ build:
In file included from
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpi.h:1104,
from spAF_incl.h:20,
from spAF_analyt.h:11,
from spAF_analyt.c:11:
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:26:2:
error: #error "SEEK_SET is #defined but must not be
for the C++ binding of MPI"
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:30:2:
error: #error "SEEK_CUR is #defined but must not be
for the C++ binding of MPI"
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:35:2:
error: #error "SEEK_END is #defined but must not be
for the C++ binding of MPI"
make: *** [spAF_analyt.o] Error 1
Did you do anything special? I am using GCC.
Thanks.
Shi
--- Matthew Knepley <knepley@xxxxxxxxx> wrote:
> On 6/17/07, Shi Jin <jinzishuai@xxxxxxxxx> wrote:
> > Hi,
> >
> > I am learning the unstructured part of Petsc,
> which
> > naturally uses C++(at least the sample I am
> studying
> > is C++). On the other hand, my old Petsc codes are
> all
> > written in C.
> > I found that once I build the Petsc with C++, the
> old
> > C codes cannot be compiled since it is trying to
> use
> > mpicxx to compile the .c source files. However, I
> do
>
> This should be no problem. I do it all the time. Any
> C++
> compiler can compile C just fine.
>
> Matt
>
> > see after the configuration stage that there is a
> > list:
> > C compiler: mpicc
> > C++ compiler: mpicxx
> > Fortran compiler: mpif77
> >
> > Is it possible to instruct Petsc to use the
> > corresponding compiler for different source
> codes?
> > Thanks a lot.
> > PS. This is how I configured my Petsc-2.3.3-p3:
> > ./config/configure.py --with-cc=gcc --with-fc=g77
> > --with-cxx=g++ --download-f-blas-lapack=1
> > --download-mpich=1 --with-clanguage=cxx
> --with-sieve=1
> > --download-boost=1 --download-chaco
> > --download-parmetis --download-fiat
> --download-generator
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Get the Yahoo! toolbar and be alerted to new email
> wherever you're surfing.
> >
>
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
> >
> >
>
>
> --
> What most experimenters take for granted before they
> begin their
> experiments is infinitely more interesting than any
> results to which
> their experiments lead.
> -- Norbert Wiener
>
>
___________________________________________________________________________________
You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener