Change

__attribute__((packed))

to 

/* __attribute__((packed)) */ 

in include/petscmath.h 

and run make again.

I think you should install a new version of Microsoft's compilers etc.

  Barry


On Nov 13, 2025, at 3:53 AM, 程奔 <202321009113@mail.scut.edu.cn> wrote:

Hi Barry


Thanks for your advice.
I use AI help me that change the file on the petsc-3.24.1/arch-mswin-c-opt/externalpackages/petsc-pkg-parmetis-f5e3aab04fd5/headers/gk_arch. 


The change is from: 

#ifdef __MSC__ 
  #include "ms_stdint.h"
  #include "ms_inttypes.h"
  #include "ms_stat.h"              
#else
#ifndef SUNOS
  #include <stdint.h>
#endif
#if !defined(WIN32) && !defined(__MINGW32__)
  #include <sys/resource.h>
#endif
  #include <inttypes.h>
  #include <sys/types.h>
  #include <sys/time.h>

#endif

To:

#if (defined(__MSC__) || defined(_MSC_VER)) && defined(_MSC_VER) && _MSC_VER < 1900
  #include "ms_stdint.h"
  #include "ms_inttypes.h"
  #include "ms_stat.h"
#else
#ifndef SUNOS
  #include <stdint.h>
#endif
#if !defined(WIN32) && !defined(__MINGW32__) && !defined(_MSC_VER)
  #include <sys/resource.h>
#endif
  #include <inttypes.h>
  #include <sys/types.h>
#if !defined(_MSC_VER)
  #include <sys/time.h>
#endif
#endif


Then I configure the PETSc:

./configure --with-debugging=0 --with-cc=cl --with-fc=0 --with-cxx=cl --download-f2cblaslapack=/cygdrive/g/mypetsc/f2cblaslapack-3.8.0.q2.tar.gz --with-mpi-include=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Include,/cygdrive/g/MSmpi/MicrosoftSDKs/Include/x64\] --with-mpi-lib=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpifec.lib,/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpi.lib\] --with-mpiexec=/cygdrive/g/MSmpi/MicrosoftMPI/Bin/mpiexec --download-metis=/cygdrive/g/mypetsc/petsc-pkg-metis-69fb26dd0428.tar.gz --download-parmetis=/cygdrive/g/mypetsc/petsc-pkg-parmetis-f5e3aab04fd5.tar.gz --with-strict-petscerrorcode=0 --with-64-bit-indices

It seems good, but then I make it

it  have the error:


make[3]: *** [gmakefile:211: arch-mswin-c-opt/obj/src/sys/objects/device/interface/mark_dcontext.o] Error 2
make[3]: Leaving directory '/cygdrive/g/mypetsc/petsc-3.24.1'
make[2]: *** [/cygdrive/g/mypetsc/petsc-3.24.1/lib/petsc/conf/rules_doc.mk:5: libs] Error 2
make[2]: Leaving directory '/cygdrive/g/mypetsc/petsc-3.24.1'
**************************ERROR*************************************
  Error during compile, check arch-mswin-c-opt/lib/petsc/conf/make.log
  Send it and arch-mswin-c-opt/lib/petsc/conf/configure.log to petsc-maint@mcs.anl.gov
********************************************************************
make[1]: *** [makefile:44: all] Error 1
make: *** [GNUmakefile:9: all] Error 2


The new configure.log and make.log is attached below.

I don't know if it is caused by the change I made or the other problems.


So I ask for your help again.  
Looking forward your reply!


sinserely,
Cheng.





-----原始邮件-----
发件人: "Barry Smith" <bsmith@petsc.dev>
发送时间: 2025-11-13 00:03:50 (星期四)
收件人: 程奔 <202321009113@mail.scut.edu.cn>
抄送: PETSc <petsc-users@mcs.anl.gov>
主题: Re: [petsc-users] Error in configuring PETSc with Cygwin on Windows by using MS-MPI

G:\VisualStudio2022\VC\Tools\MSVC\14.37.32822\include\stdint.h(37): error C2371: 'int_fast16_t': redefinition; different basic types
G:\mypetsc\petsc-3.24.1\arch-mswin-c-opt\externalpackages\petsc-pkg-parmetis-f5e3aab04fd5\headers\ms_stdint.h(80): note: see declaration of 'int_fast16_t'
G:\VisualStudio2022\VC\Tools\MSVC\14.37.32822\include\stdint.h(41): error C2371: 'uint_fast16_t': redefinition; different basic types
G:\mypetsc\petsc-3.24.1\arch-mswin-c-opt\externalpackages\petsc-pkg-parmetis-f5e3aab04fd5\headers\ms_stdint.h(84): note: see declaration of 'uint_fast16_t'
G:\VisualStudio2022\VC\Tools\MSVC\14.37.32822\include\stdint.h(49): warning C4005: 'INT8_MIN': macro redefinition
G:\mypetsc\petsc-3.24.1\arch-mswin-c-opt\externalpackages\petsc-pkg-parmetis-f5e3aab04fd5\headers\ms_stdint.h(107): note: see previous definition of 'INT8_MIN'

Parmetis has its own definitions for many C standard types, etc in headers\ms_stdint.h that duplicate what is available in stdint.h on Unix systems. Normally, this gets included when __MSC_ is defined instead of stdint.h (in gk_arch.h).

But for some reason, with your system it appears that Microsoft's stdint.h is also getting included; presumably brought in through some other system include file since it is only included in one place.

$ git grep stdint.h
headers/gk_arch.h:  #include "ms_stdint.h"
headers/gk_arch.h:  #include <stdint.h>
headers/ms_inttypes.h:#include "ms_stdint.h"
headers/ms_stdint.h:// ISO C9x  compliant stdint.h for Microsoft Visual Studio

You have a fairly old VisualStudio, 2022. Can you upgrade to the latest? Let us know if this resolves the problem.

Barry




 





On Nov 12, 2025, at 5:29 AM, 程奔 <202321009113@mail.scut.edu.cn> wrote:

Hi Barry
Thanks for your reply.
I check the package parmetis,and the "petsc-pkg-parmetis-45100eac9301.tar.gz" is form https://bitbucket.org/petsc/pkg-parmetis/get/v4.0.3.tar.gz. So I made a mistake about the package.
Then I download the package form https://bitbucket.org/petsc/pkg-parmetis/get/v4.0.3-p9.tar.gz and it is "petsc-pkg-parmetis-f5e3aab04fd5.tar.gz" 


Then the compiler option in configuration is:
./configure --with-debugging=0 --with-cc=cl --with-fc=0 --with-cxx=cl --download-f2cblaslapack=/cygdrive/g/mypetsc/f2cblaslapack-3.8.0.q2.tar.gz --with-mpi-include=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Include,/cygdrive/g/MSmpi/MicrosoftSDKs/Include/x64\] --with-mpi-lib=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpifec.lib,/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpi.lib\] --with-mpiexec=/cygdrive/g/MSmpi/MicrosoftMPI/Bin/mpiexec --download-metis=/cygdrive/g/mypetsc/petsc-pkg-metis-69fb26dd0428.tar.gz --download-parmetis=/cygdrive/g/mypetsc/petsc-pkg-parmetis-f5e3aab04fd5.tar.gz --with-strict-petscerrorcode=0 --with-64-bit-indices

but it still have the same error:
*********************************************************************************************
=============================================================================================
=============================================================================================
                Configuring PARMETIS with CMake; this may take several minutes
=============================================================================================
=============================================================================================
               Compiling and installing PARMETIS; this may take several minutes
=============================================================================================


*********************************************************************************************
           UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
---------------------------------------------------------------------------------------------
                               Error running make on  PARMETIS


*********************************************************************************************


The new configure.log is attached below.
So I ask for your help again.  
Looking forward your reply!


sinserely,
Cheng.




-----原始邮件-----
发件人: "Barry Smith" <bsmith@petsc.dev>
发送时间: 2025-11-11 23:29:01 (星期二)
收件人: "Matthew Knepley" <knepley@gmail.com>
抄送: 程奔 <ctchengben@mail.scut.edu.cn>, petsc-users@mcs.anl.gov
主题: Re: [petsc-users] Error in configuring PETSc with Cygwin on Windows by using MS-MPI


  Where/how did you obtain /cygdrive/g/mypetsc/petsc-pkg-parmetis-45100eac9301.tar.gz ? Was it from PETSc ./configure?

    self.version          = '4.0.3'
    self.versionname      = 'PARMETIS_MAJOR_VERSION.PARMETIS_MINOR_VERSION.PARMETIS_SUBMINOR_VERSION'
    self.gitcommit         = 'v'+self.version+'-p9'
    self.download          = ['git://https://bitbucket.org/petsc/pkg-parmetis.git','https://bitbucket.org/petsc/pkg-parmetis/get/'+self.gitcommit+'.tar.gz']



On Nov 11, 2025, at 7:35 AM, Matthew Knepley <knepley@gmail.com> wrote:

On Tue, Nov 11, 2025 at 4:44 AM 程奔 <ctchengben@mail.scut.edu.cn> wrote:
Hello,
Recently I try to install PETSc with Cygwin since I'd like to use PETSc with Visual Studio on Windows10 plateform.For the sake of clarity, I firstly list the softwares/packages used below:
1. PETSc: version 3.14.1
2. VS: version 2022 
3. MS MPI: download Microsoft MPI v10.1.2
4. Cygwin

Quick question: Have you considered installing on WSL? I have had much better luck with that on Windows.

This seems to be an incompatibility of ParMetis Windows support and your version:

G:\VisualStudio2022\VC\Tools\MSVC\14.37.32822\include\stdint.h(37): error C2371: 'int_fast16_t': redefinition; different basic types^M
G:\mypetsc\petsc-3.24.1\arch-mswin-c-opt\externalpackages\petsc-pkg-parmetis-f5e3aab04fd5\headers\ms_stdint.h(80): note: see declaration of 'int_fast16_t'^M
G:\VisualStudio2022\VC\Tools\MSVC\14.37.32822\include\stdint.h(41): error C2371: 'uint_fast16_t': redefinition; different basic types^M
G:\mypetsc\petsc-3.24.1\arch-mswin-c-opt\externalpackages\petsc-pkg-parmetis-f5e3aab04fd5\headers\ms_stdint.h(84): note: see declaration of 'uint_fast16_t'^M 

  Thanks,

     Matt

And the compiler option in configuration is:
./configure --with-debugging=0 --with-cc=cl --with-fc=0 --with-cxx=cl 
--download-f2cblaslapack=/cygdrive/g/mypetsc/f2cblaslapack-3.8.0.q2.tar.gz 
--with-mpi-include=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Include,/cygdrive/g/MSmpi/MicrosoftSDKs/Include/x64\] 
--with-mpi-lib=\[/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpifec.lib,/cygdrive/g/MSmpi/MicrosoftSDKs/Lib/x64/msmpi.lib\] 
--with-mpiexec=/cygdrive/g/MSmpi/MicrosoftMPI/Bin/mpiexec 
--download-metis=/cygdrive/g/mypetsc/petsc-pkg-metis-69fb26dd0428.tar.gz 
--download-parmetis=/cygdrive/g/mypetsc/petsc-pkg-parmetis-45100eac9301.tar.gz 
--with-strict-petscerrorcode=0 --with-64-bit-indices --download-hdf5=/cygdrive/g/mypetsc/hdf5-1.14.3-p1.tar.bz2






but there return an error:
*********************************************************************************************
=============================================================================================
=============================================================================================
                Configuring PARMETIS with CMake; this may take several minutes
=============================================================================================
=============================================================================================
               Compiling and installing PARMETIS; this may take several minutes
=============================================================================================


*********************************************************************************************
           UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
---------------------------------------------------------------------------------------------
                               Error running make on  PARMETIS


*********************************************************************************************


The configure.log is attached below.
So I write this email to report my problem and ask for your help.  
Looking forward your reply!


sinserely,
Cheng.


-- 
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

https://www.cse.buffalo.edu/~knepley/