Re: [petsc-users] ``--with-clanguage=c++" turns on "PETSC_HAVE_COMPLEX"?
On Fri, 3 May 2019, Fande Kong via petsc-users wrote: > On Fri, May 3, 2019 at 8:02 PM Balay, Satish wrote: > > > On Fri, 3 May 2019, Fande Kong via petsc-users wrote: > > > > > It looks like mpicxx from openmpi does not handle this correctly. > > > > Perhaps my earlier messages was not clear. The problem is not with > > OpenMPI - but your build of it. Its installed with 'clang' as the C++ > > compiler - it should be built with 'clang++' as the c++ compiler. > > > > Oh, I see. Thanks. I've added a check to configure https://bitbucket.org/petsc/petsc/pull-requests/1622/configure-when-with-clanguage-cxx-is-used/diff Satish
Re: [petsc-users] ``--with-clanguage=c++" turns on "PETSC_HAVE_COMPLEX"?
Fande Kong via petsc-users writes: > It looks like mpicxx from openmpi does not handle this correctly. I > switched to mpich, and it works now. > > However there is till some warnings: > > *clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this > behavior is deprecated [-Wdeprecated]* > * CXX arch-linux2-c-opt-memory/obj/dm/impls/plex/glexg.o* > * CXX arch-linux2-c-opt-memory/obj/dm/impls/plex/petscpartmatpart.o* > *clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this > behavior is dep* Clang has always done this. I don't know a clean way to work around the warning, but we don't recommend with-clanguage=c++ unless you're on a platform where a sane C compiler doesn't exist.
Re: [petsc-users] ``--with-clanguage=c++" turns on "PETSC_HAVE_COMPLEX"?
On Fri, 3 May 2019, Fande Kong via petsc-users wrote: > It looks like mpicxx from openmpi does not handle this correctly. Perhaps my earlier messages was not clear. The problem is not with OpenMPI - but your build of it. Its installed with 'clang' as the C++ compiler - it should be built with 'clang++' as the c++ compiler. > I switched to mpich, and it works now. > > However there is till some warnings: > > *clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this > behavior is deprecated [-Wdeprecated]* > * CXX arch-linux2-c-opt-memory/obj/dm/impls/plex/glexg.o* > * CXX arch-linux2-c-opt-memory/obj/dm/impls/plex/petscpartmatpart.o* > *clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this > behavior is dep* Yes - because PETSc sources are in C - and you are building with --with-clanguage=cxx - and this compiler thinks one should not compile .c sources as c++. Satish > > Fande, > > > On Fri, May 3, 2019 at 7:29 PM Balay, Satish wrote: > > > > > 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-ma...@mcs.anl.gov * > > > ** > > > > > > The make and configure logs are attached. > > > > > > Fande, > > > > > > > >
Re: [petsc-users] ``--with-clanguage=c++" turns on "PETSC_HAVE_COMPLEX"?
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-ma...@mcs.anl.gov * > ** > > The make and configure logs are attached. > > Fande, >