[petsc-users] ``--with-clanguage=c++" turns on "PETSC_HAVE_COMPLEX"?

Balay, Satish balay at mcs.anl.gov
Fri May 3 20:29:08 CDT 2019


>>>>>>>>
Executing: mpicxx -show                                                                                                                                                    stdout: clang -I/Users/kongf/projects/openmpi-2.1.1_installed/include -L/Users/kongf/projects/openmpi-2.1.1_installed/lib -lmpi
<<<<

Hm - I think this [specifying a C compiler as c++] is the trigger of this problem.

configure checks if the c++ compiler supports complex. This test was successful [as it was done with .cxx file - and presumably clang switches to c++ mocd for a .cxx file.

However PETSc sources a .c - so its likely compiling PETSc as C -  so things are now inconsistant - and broken..

Note:
PETSC_HAVE_COMPLEX => compilers support complex - so define a complex datatype
PETSC_USE_COMPLEX => build PETSc with PetscScalar=complex


Satish

On Fri, 3 May 2019, Fande Kong via petsc-users wrote:

> Hi All,
> 
> Comping PETSc with ``--with-clanguage=c"  works fine. But I could not
> compile PETSc with "--with-clanguage=c++" since the flag
> "PETSC_HAVE_COMPLEX" was wrongly set on by this option.
> 
> */Users/kongf/projects/petsc/src/sys/objects/pinit.c:913:21: error:
> expected parameter declarator*
> *    PetscComplex ic(0.0,1.0);*
> *                    ^*
> */Users/kongf/projects/petsc/src/sys/objects/pinit.c:913:21: error:
> expected ')'*
> */Users/kongf/projects/petsc/src/sys/objects/pinit.c:913:20: note: to match
> this '('*
> *    PetscComplex ic(0.0,1.0);*
> *                   ^*
> */Users/kongf/projects/petsc/src/sys/objects/pinit.c:914:13: error:
> assigning to 'PetscComplex' (aka '_Complex double') from incompatible type
> 'PetscComplex ()' (aka '_Complex double ()')*
> *    PETSC_i = ic;*
> *            ^ ~~*
> *3 errors generated.*
> *make[2]: *** [arch-linux2-c-opt-memory/obj/sys/objects/pinit.o] Error 1*
> *make[2]: *** Waiting for unfinished jobs....*
> *make[2]: Leaving directory `/Users/kongf/projects/petsc'*
> *make[1]: *** [gnumake] Error 2*
> *make[1]: Leaving directory `/Users/kongf/projects/petsc'*
> ***************************ERROR**************************************
> *  Error during compile, check
> arch-linux2-c-opt-memory/lib/petsc/conf/make.log*
> *  Send it and arch-linux2-c-opt-memory/lib/petsc/conf/configure.log to
> petsc-maint at mcs.anl.gov <petsc-maint at mcs.anl.gov>*
> **********************************************************************
> 
> The make and configure logs are attached.
> 
> Fande,
> 



More information about the petsc-users mailing list