[mpich-discuss] need to compile unix code as windows exe

Manal Helal manalorama at gmail.com
Tue Nov 18 04:59:37 CST 2008


Hello

Thank you for your help, but I still need help to get my program running
on a windows cluster please. I followed both approaches as mentioned before,

The first is trying to configure mpich2-1.0.8 to use mpicc on cygwin,
gives the following errors on cygwin on Windows XP 2002 with SP 3
*****************************************
$ ./configure
./configure: line 12: $'\r': command not found
./configure: line 23: syntax error near unexpected token `$'in\r''
'/configure: line 23: `  case `(set -o) 2>/dev/null` in
*****************************************

the second is using the cygwin gcc and linking with lmpich, and that's
how it goes:

some information that might help:
the file "libmpi.a" and "libfmpich2g.a" in "C:\Program Files\MPICH2\lib"
are 0kb files, I have "libmpichd.a" as a 1061 Kb file in the same
folder, and "libmpich.a" as 1058 KB, and 'libmpicxx.a" as 199 kb file,
"mpi.lib" is a 126 kb file, and "fmpich2.lib" as 130 kb file.

the gcc version is
*****************************************
$ gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with:
/usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc
--libdir=/usr/lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls
--without-included-gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj
--disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug
--enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry
--enable-sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
*****************************************

compiling a simple program like :
*****************************************
#include <stdio.h>
#include <math.h>
#include <mpi.h>

int main(int argc, char **argv) {
    int myProcid, ClusterSize;
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &myProcid);
    MPI_Comm_size(MPI_COMM_WORLD, &ClusterSize);
    printf ("Hello World Process %d / %d.\n", myProcid, ClusterSize);
    //printf ("the ceill(10.55) = %lld\n" , ceill(10.55));
    getc (stdin);
    MPI_Finalize();
    return 0;
}
*****************************************
It is compiled as:
*****************************************
$ gcc hello.c -I "/cygdrive/f/Program Files/MPICH2/include" -L
"/cygdrive/f/Program Files/MPICH2/lib" -lmpich -lm -o hello.exe

creates the exe file with no errors, however, when I try to execute it
using the mpich2 for windows "wmpiexec" Interface with 4 processes all
on the current node and showing different windows, the windows don't
come up, command shown is:
*****************************************
"C:\Program Files\MPICH2\bin\mpiexec.exe" -n 4  -noprompt
"C:\cygwin\home\user\hello.exe"
*****************************************

copying the same command to cygwin, I get the errors shown:
*****************************************
$ "/cygdrive/f/Program Files/MPICH2/bin/mpiexec.exe" -n 4  -noprompt
hello.exe
Credentials for Manal rejected connecting to mhelallpt-xp
Aborting: Unable to connect to mhelallpt-xp
*****************************************


However, compiling my mpi program using the following command in a make
file:
*****************************************
$gcc "/cygdrive/f/Program Files/MPICH2/include" -L "/cygdrive/f/Program
Files/MPICH2/lib" -lmpich -lm  main.c

where the main.o is:
main.o :  main.c main.h utils.h globals.h
    gcc -g -I "/cygdrive/f/Program Files/MPICH2/include" -L
"/cygdrive/f/Program Files/MPICH2/lib" main.c -lmpich -o main.o
*****************************************


I get the following errors:
*****************************************
/home/user/proj/main.c:112: undefined reference to `_MPI_Barrier'
/home/user/proj/main.c:174: undefined reference to `_MPI_Wtime'
/home/user/proj/main.c:242: undefined reference to `_MPI_Send'
/home/user/proj/main.c:251: undefined reference to `_MPI_Recv'
/home/user/proj/main.c:314: undefined reference to `_MPI_Init'
/home/user/proj/main.c:316: undefined reference to `_MPI_Comm_rank'
/home/user/proj/main.c:318: undefined reference to `_MPI_Comm_size'
/home/user/proj/main.c:320: undefined reference to `_MPI_Comm_group'
/home/user/proj/main.c:321: undefined reference to `_MPI_Comm_create'
/home/user/proj/main.c:366: undefined reference to `_MPI_Finalize'
/home/user/proj/main.c:3254: undefined reference to `_MPI_Waitall'
/home/user/proj/main.c:3379: undefined reference to `_MPI_Isend'
/home/user/proj/main.c:3514: undefined reference to `_MPI_Iprobe'
/home/user/proj/main.c:3520: undefined reference to `_MPI_Recv'
*****************************************

It is basically all MPI calls I make, and what I couldn't understand,
why the "MPI_Init" "MPI_Comm_rank", "MPI_Comm_size" and "MPI_Finalize"
was found on the test program, and not found in the main program.

when I compile using the above command without the make file, I get more
errors like:

*****************************************
main.c:165: error: `MPI_Status' undeclared (first use in this function)
main.c:242: error: `MPI_INT' undeclared (first use in this function)
main.c:302: error: `MPI_Group' undeclared (first use in this function)
main.c:316: error: `MPI_COMM_WORLD' undeclared (first use in this function)
main.c:3432: error: `MPI_LONG' undeclared (first use in this function)
main.c:3435: error: `MPI_LONG_LONG' undeclared (first use in this function)
main.c:3485: error: `MPI_Status' undeclared (first use in this function)
main.c:3514: error: `MPI_ANY_SOURCE' undeclared (first use in this function)
main.c:3514: error: `MPI_ANY_TAG' undeclared (first use in this function)
main.c:3520: error: `MPI_LONG' undeclared (first use in this function)
main.c:3533: error: `MPI_LONG_LONG' undeclared (first use in this function)
main.c:3205: error: `MPI_SUCCESS' undeclared (first use in this function)
main.c:3209: error: `MPI_ERR_COMM' undeclared (first use in this function)
main.c:3213: error: `MPI_ERR_TYPE' undeclared (first use in this function)
main.c:3217: error: `MPI_ERR_COUNT' undeclared (first use in this function)
main.c:3221: error: `MPI_ERR_TAG' undeclared (first use in this function)
main.c:3225: error: `MPI_ERR_RANK' undeclared (first use in this function)
*****************************************

I also  get simillar errors to all long long functions which are not
found on cygwin when I searched or used the "man" command like the
following:

*****************************************
/home/user/proj/main.c:907: undefined reference to `_sqrtl'
/home/user/proj/main.c:1743: undefined reference to `_powl'
/home/user/proj/main.c:2006: undefined reference to `_ceill'
/home/user/proj/main.c:2035: undefined reference to `_floorl'
*****************************************
I appreciate your help a lot,

Kind Regards,

Manal



More information about the mpich-discuss mailing list