问题
Attempting to compile MPICH2 on a Windows machine using Cygwin.
A bit of relevant information
- $ uname -> CYGWIN_NT-6.1
- $ gcc --version -> gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- MPICH2 Version: 1.5
Configuration seems to have completed appropriately, but during compilation I received the following:
**** Making src/misc ....
make --no-print-directory build_lib_bin
make --no-print-directory mpe_debug_objs
make --no-print-directory /home/Daeden/issm/trunk-jpl/externalpackages/mpich2/src/src/mpe2/lib/libmpe_nompi.a
make[7]: `/home/Daeden/issm/trunk-jpl/externalpackages/mpich2/src/src/mpe2/lib/libmpe_nompi.a' is up to date.
make --no-print-directory /home/Daeden/issm/trunk-jpl/externalpackages/mpich2/src/src/mpe2/lib/libmpe.a
gcc -I/home/Daeden/issm/trunk-jpl/externalpackages/mpich2/src/src/include -I/home/Daeden/issm/trunk-jpl/externalpackages/mpich2/src/ src/include -I.. -I../include -I../../.. -I../../../include -o dbxerr.po -c dbxerr.c
dbxerr.c: In function `MPE_DefaultHandler':
dbxerr.c:429: error: parse error before '{' token
dbxerr.c:432: error: argument "sig" doesn't match prototype
dbxerr.c:407: error: prototype declaration
dbxerr.c:461: warning: passing arg 2 of `signal' from incompatible pointer type
dbxerr.c:463: warning: passing arg 2 of `signal' from incompatible pointer type
dbxerr.c:465: warning: passing arg 2 of `signal' from incompatible pointer type
dbxerr.c:467: warning: passing arg 2 of `signal' from incompatible pointer type
dbxerr.c:469: warning: passing arg 2 of `signal' from incompatible pointer type
dbxerr.c:473: warning: passing arg 2 of `signal' from incompatible pointer type
Makefile:82: recipe for target `dbxerr.po' failed
make[7]: *** [dbxerr.po] Error 1
Makefile:111: recipe for target `default' failed
make[6]: *** [default] Error 2
Makefile:43: recipe for target `build_lib_bin' failed
make[5]: *** [build_lib_bin] Error 2
Makefile:26: recipe for target `all' failed make[4]: *** [all] Error 2
Checking 'dbxerr.c' I find this:
#if defined(HAVE_SIGHANDLER_T)
#define SIG_HANDLER_PROTOTYPE sighandler_t
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
void MPE_DefaultHandler( sig )
int sig
#elif defined(MPI_sun4)
#define SIG_HANDLER_PROTOTYPE int, int, struct sigcontext *, char *
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
void MPE_DefaultHandler( sig, code, scp, addr )
int sig, code;
struct sigcontext *scp;
char *addr;
#elif defined(MPI_IRIX)
#define SIG_HANDLER_PROTOTYPE int, int, struct sigcontext *
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
void MPE_DefaultHandler( sig, code, scp )
int sig, code;
struct sigcontext *scp;
#else
/* The default Posix definition has a single int */
#define SIG_HANDLER_PROTOTYPE int
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
void MPE_DefaultHandler( int sig )
#endif
{
static char buf[128];
signal( sig, SIG_DFL );
if (sig >= 0 && sig <= 20)
sprintf( buf, "Caught signal %s", SIGNAME[sig] );
else
strcpy( buf, "Caught signal " );
fprintf( stderr, "%s\n", buf );
MPE_Start_debugger( );
}
By checking the 'config.log's I found:
$ find ./ -name 'config.log' | xargs grep 'HAVE_SIGHANDLER'
./src/mpe2/src/misc/config.log:| #define HAVE_SIGHANDLER_T 1
./src/mpe2/src/misc/config.log:#define HAVE_SIGHANDLER_T 1
This confirms that:
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
void MPE_DefaultHandler( sig )
int sig
is being used by the CPP.
I found that 'SIG_HANDLER_PROTOTYPE' is defined as:
$ find ./ -name '*.c' | xargs grep 'SIG_HANDLER_PRO'
./src/mpe2/src/misc/src/dbxerr.c:#define SIG_HANDLER_PROTOTYPE sighandler_t
'sighandler_t' is defined in '/usr/include/signal.h' as:
typedef _sig_func_ptr sighandler_t; /* glibc naming */
Finally, '_sig_func_ptr' is defined as:
typedef void (*_sig_func_ptr)(int);
This is as far as my own research has taken me and I can't seem to fit the pieces together. I do not understand why there is a prototype mismatch. I will continue to try and fix this issue on my own, but any help would be appreciated!
Thanks in advance!
UPDATE:
I was reexamining the output of 'make' and I think I made a mistake. I assumed the problem was with the declaration:
void MPE_DefaultHandler ( SIG_HANDLER_PROTOTYPE );
However, the problem appears to be with the definition:
void MPE_DefaultHandler( sig )
'sig' appears to be an int type, but I can't understand what type 'SIG_HANDLER_PROTOTYPE' is. Can someone explain this:
typedef void (*_sig_func_ptr)(int);
回答1:
MPICH2 (now just "MPICH" for versions >= 3.0) does not currently test or support Windows. The last working version on Windows is 1.4.1p1, and even then I'm not sure of the status of Cygwin support.
Using cygwin might be your best bet if you need MPICH2 v1.5 or MPICH v3.0.x. v3.0.2 does not bundle MPE with it, so you may avoid some of the problems that you mention. You can also approximate this behavior with 1.5 by passing --disable-mpe
to configure
.
回答2:
If you still want to get MPICH working on Windows, you might try the version packaged by Microsoft. It's a derivative of MPICH. There's also an old version of the Windows binary available. You can find out more on the downloads page for MPICH (http://www.mpich.org/downloads/).
来源:https://stackoverflow.com/questions/14915812/mpich2-compilation-issue-using-cygwin