[petsc-users] compile PETSc on win using clang

Satish Balay balay at mcs.anl.gov
Tue Jan 24 19:36:15 CST 2023


Do you have clang in your PATH? Is the binary named clang for something else?


>>>>>>>
              Defined make macro "CC" to "/home/xian/dev/star/petsc/lib/petsc/bin/win32fe/win32fe cl --use clang"
Executing: /home/xian/dev/star/petsc/lib/petsc/bin/win32fe/win32fe cl --use clang -c -o /tmp/petsc-t4q6osvc/config.setCompilers/conftest.o -I/tmp/petsc-t4q6osvc/config.setCompilers -O2 -MD -wd4996  /tmp/petsc-t4q6osvc/config.setCompilers/conftest.c
Possible ERROR while running compiler: exit code 15
Source:
#include "confdefs.h"
#include "conffix.h"

int main() {
;
  return 0;
}

          Error testing C compiler: Cannot compile C with /home/xian/dev/star/petsc/lib/petsc/bin/win32fe/win32fe cl --use clang.

<<<<<<

You can try this test below manually - with the --verbose option. [I don't have clang - so using 'cl' here]

>>>>>>
balay at ps5 ~/petsc/src/benchmarks
$ ~/petsc/lib/petsc/bin/win32fe/win32fe cl --use cl --verbose sizeof.c

Using tool: cl
Win32 Development Tool Front End, version 1.11.4 Fri, Sep 10, 2021  6:33:40 PM
Attempting to create file: C:\cygwin64\tmp\wfe2972.tmp
cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30709 for x64
del C:\cygwin64\tmp\wfe2972.tmp
Attempting to create file: C:\cygwin64\tmp\wfe2983.tmp
cl sizeof.c -link
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30709 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

sizeof.c
Microsoft (R) Incremental Linker Version 14.30.30709.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:sizeof.exe 
sizeof.obj 
del C:\cygwin64\tmp\wfe2983.tmp

balay at ps5 ~/petsc/src/benchmarks
$ ~/petsc/lib/petsc/bin/win32fe/win32fe cl --use dummy-binary --verbose sizeof.c

Using tool: dummy-binary
Win32 Development Tool Front End, version 1.11.4 Fri, Sep 10, 2021  6:33:40 PM
Attempting to create file: C:\cygwin64\tmp\wfe6AD0.tmp
dummy-binary
win32feutils::CreateProcess failed.
dummy-binary
The system cannot find the file specified.

del C:\cygwin64\tmp\wfe6AD0.tmp

balay at ps5 ~/petsc/src/benchmarks
$ 

<<<<<<<

Satish



On Wed, 25 Jan 2023, Guo, Sam wrote:

> configure.log with -with-cc="win32fe cl --use clang"
> ________________________________
> From: Satish Balay <balay at mcs.anl.gov>
> Sent: Tuesday, January 24, 2023 5:15 PM
> To: Guo, Sam (DI SW STS SDDEV MECH PHY FEA FW) <sam.guo at siemens.com>
> Cc: Barry Smith <bsmith at petsc.dev>; petsc-users <petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] compile PETSc on win using clang
> 
> Configure Options: --configModules=PETSc.Configure --optionsModule=config.compilerOptions --with-cc="win32fe cl" --use win32fe clang --with-fc=0
>  --with-debugging=0 -CFLAGS="-O2 -MD -wd4996" -CXXFLAGS="-O2 -MD -wd4996" --with-mpi=0 --with-clean=1 --force --with-scalar-type=real
>  --ignore-cygwin-link -CFLAGS="-O2 -MD -wd4996" -CXXFLAGS="-O2 -MD -wd4996"
> 
> It should be --with-cc="win32fe cl --use clang"
> 
> But then - this mode is untested with configure - so there could be other issues.
> 
> Also - do you need c++? If not - use --with-cxx=0. This can avoid the error below. [for clang++ - you might need --with-cxx="win32fe cl --use clang++" - again untested - so might not work..]
> 
> Satish
> 
> 
> On Tue, 24 Jan 2023, Guo, Sam wrote:
> 
> > Attached please find configure.log.
> >
> > error messgae:
> > C:\home\xian\dev\star\petsc\src\sys\objects\device\INTERF~1\device.cxx(486): error C2065: 'PETSC_DEVICE_CASE': undeclared identifier
> >
> > ________________________________
> > From: Satish Balay <balay at mcs.anl.gov>
> > Sent: Tuesday, January 24, 2023 2:00 PM
> > To: Barry Smith <bsmith at petsc.dev>
> > Cc: Guo, Sam (DI SW STS SDDEV MECH PHY FEA FW) <sam.guo at siemens.com>; petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> > Subject: Re: [petsc-users] compile PETSc on win using clang
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.wikihow.com%2FInstall-Clang-on-Windows&data=05%7C01%7Csam.guo%40siemens.com%7Cf91c34cd02bb4cea9d4808dafe71b408%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C638102061582605791%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DW33e3209lC4piF9wlJeQLR%2BRmAHQakczlgTUKe%2Bcuo%3D&reserved=0
> >
> > Is the clang you have from visual studio - as described above?
> >
> > We don't have experience with using this variant of clang.
> >
> > If its compatible with 'cl' - and supports the same command interface as 'cl' then the following might work [assuming clang.exe is the compiler binary installed - and available in PATH]:
> >
> > '--with-cc=win32fe cl --use clang'
> >
> > Satish
> >
> >
> > On Tue, 24 Jan 2023, Barry Smith wrote:
> >
> > >
> > >    Are you using clang as a replacement for the
> > >
> > >    *  "Unix-like" Cygwin GNU compilers compilers or
> > >
> > >    *  MinGW GNU compilers that are compatible with the Microsoft compilers?
> > >
> > >   If the former, follow the instructions for using the Cygwin GNU compilers, if the latter follow the directions for the MinGW compilers.
> > >
> > >   Send the configure.log and make.log if things go wrong and we'll help you out.
> > >
> > >   Barry
> > >
> > >
> > >
> > >
> > > > On Jan 24, 2023, at 4:01 PM, Guo, Sam <sam.guo at siemens.com> wrote:
> > > >
> > > > Hi PETSc dev team,
> > > >    I try to compile PETSc on win using clang. I am wondering if you could give me some hint. (I’ve already made intel compiler work on win using win32fe icl).
> > > >
> > > > Thanks,
> > > > Sam Guo
> > >
> > >
> >
> 


More information about the petsc-users mailing list