PnetCDF icon indicating copy to clipboard operation
PnetCDF copied to clipboard

pnetcdf and mingw (msys2)

Open 3rav opened this issue 2 years ago • 3 comments

I was able to compile pnetcdf in the mingw environment using msmpi, but there were such errors:

libtool: compile:  /mingw64/bin/mpicc -DHAVE_CONFIG_H -I. -I../../../../pnetcdf-1.12.2/src/drivers/common -I../../../src/include -I../../../../pnetcdf-1.12.2/src/include -I../../../../pnetcdf-1.12.2/src/drivers/include -I../../../src/drivers/include -march=x86-64 -mtune=generic -O2 -pipe -MT error_mpi2nc.lo -MD -MP -MF .deps/error_mpi2nc.Tpo -c ../../../../pnetcdf-1.12.2/src/drivers/common/error_mpi2nc.c  -DDLL_EXPORT -DPIC -o .libs/error_mpi2nc.o
../../../../pnetcdf-1.12.2/src/drivers/common/error_posix2nc.c: In function 'ncmpii_error_posix2nc':
../../../../pnetcdf-1.12.2/src/drivers/common/error_posix2nc.c:34:14: error: 'EDQUOT' undeclared (first use in this function)
   34 |         case EDQUOT:

reapir by add to error_posix2nc.c:

 #include <errno.h>
+#include <_wsa_errnos.h>
 
 /*----< ncmpii_error_posix2nc() ------------------------------------------------*/
 /* translate posix io error codes to PnetCDF/netCDF error codes */
@@ -31,7 +32,7 @@
         case ENOTDIR :
         case EISDIR:
             return NC_EBAD_FILE;
-        case EDQUOT:
+        case WSAEDQUOT:
             return NC_EQUOTA;
         case ENOENT:
             return NC_ENOENT;

and:

make[2]: Entering directory '/usr/local/pkg_pnetcdf/src/build-x86_64-w64-mingw32/src/libs'
  GEN      libpnetcdf.la
libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only
libtool: link: (cd .libs/libpnetcdf.lax/libdispatchers.a && ar x "/usr/local/pkg_pnetcdf/src/build-x86_64-w64-mingw32/src/libs/../dispatchers/.libs/libdispatchers.a")

3rav avatar Oct 14 '21 11:10 3rav

Thanks for reporting the problem and a fix. However, mingw environment is not officially supported. This is simply because we do not have the resource for development and test.

wkliao avatar Oct 15 '21 16:10 wkliao

I was able to compile pnetcdf using msmpi for the mingw64 version but for the version mingw32 it has this error (https://github.com/3rav/MINGW-packages/runs/3893876517?check_suite_focus=true):

  checking for _FILE_OFFSET_BITS value needed for large files... 64
  checking for MPI_Comm_rank... no
  configure: error: 
  checking for library containing MPI_Comm_rank... no
     -----------------------------------------------------------------------
       Invalid MPI compiler specified or detected: "/mingw32/bin/mpicc"
       A working MPI C compiler is required. Please specify the location
       of one either in the MPICC environment variable (not CC variable) or
       through --with-mpi configure flag. Abort.
     -----------------------------------------------------------------------
  ==> ERROR: A failure occurred in build().

This failure is to be expected, because 32-bit symbols exported by msmpi.dll are mangled while 64-bit ones are not. How can I just skip this test completely?

3rav avatar Oct 18 '21 06:10 3rav

I wonder if this issue has been resolved in your build. The error message indicates the problem of your MPI compiler that failed to compile a simple program that calls MPI_Comm_rank.

wkliao avatar Dec 13 '23 17:12 wkliao