[petsc-users] "--with-cxx=CC" option for ./configure?

Satish Balay balay at mcs.anl.gov
Wed Jan 22 16:23:49 CST 2014


You can use the petsc makefile for this and then add the following lines
after "include ${PETSC_DIR}/conf/rules" line..

PCC=${CXX}
PCC_LINKER=${CXX}

Now your code will be compiled and linked in with the c++ compiler
[assuming petsc is configured with a c++ compiler]

Satish

On Wed, 22 Jan 2014, David Liu wrote:

> Cool that works.
> 
> I was wondering is there an easy way to do this, however? Right now I am
> just copy and pasting the huge block of text that make generates, and then
> replacing the C compiler with the C++ compiler.
> 
> To the best of my understanding, the makefile rule to make an executable
> called "codeout" is
> 
> codeout: code.o
>             ${CLINKER} blah blah $< $@ blah blah
> 
> I find that if I redefine CLINKER=<c++ compiler>, then the make step going
> from code.o to the executable works, but the step going from code.c to
> code.o still uses the original value of CLINKER.
> 
> best,
> David
> 
> 
> 
> 
> On Wed, Jan 22, 2014 at 10:28 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> >
> > On Jan 22, 2014, at 9:17 AM, David Liu <daveliu at mit.edu> wrote:
> >
> > > Hi,
> > >
> > > I’m trying to run a solver code I wrote in C++ on the Kraken
> > supercomputer. Apparently Kraken already has a pre-built version of Petsc
> > that is optimized for their Cray architecture. So I try compiling my code,
> > and as expected, get an error message saying that “<iostream>” not found,
> > which I’m guessing is because Petsc wasn’t configured with
> > “-with-c-language=cxx”. Fair enough.
> >
> >    You can still use the C++ compiler to compiler YOUR code even without
> > PETSc being built with -with-c-language=cxx
> >
> > >
> > > However, at the end of the error message, it gives me the list of things
> > it *was* configured with, and I see the flags “--with-cc=cc” and
> > “--with-cxx=CC”. Does anyone know what that second flag means?
> >
> >   That is the C++ compiler.
> >
> >    So in this case just use CC to compile your code. (note Cray
> > auto-magically has the compiler know all about the MPI includes etc).
> >
> >    Barry
> >
> >
> >
> > >
> > > best,
> > > David
> >
> >
> 


More information about the petsc-users mailing list