[mpich-discuss] question regarding compiling/linking under MingW (MPICH2 1.08)

Dorian Krause ddkrause at uni-bonn.de
Sun Jan 4 11:29:23 CST 2009


ting lei wrote:
> Hi,
> Sorry to bother all. I have some questions regarding using MPICH2 1.08 
> with MingW
> I tried compile MPICH2 1.08 on two different machines, and have met 
> different problems. I was wondering if someone with a lot experience 
> could help me out here. thanks in advance.
> 1) The most successful attempt was on a win32 platform, XPSP3 with 
> MingW+gcc3.4.5
> The command line I used was:
> gcc -I /c/MPICH2/include/ -lmpi -L/c/MPICH2/lib/ test.c
> and I get the following error:
> C:/DOCUME~1/ting/LOCALS~1/Temp/cc40AD3K.o:test.c:(.text+0x38): 
> undefined reference to `MPI_Init'
> C:/DOCUME~1/ting/LOCALS~1/Temp/cc40AD3K.o:test.c:(.text+0x4b): 
> undefined reference to `MPI_Comm_rank'
> collect2: ld returned 1 exit status

Could you try

gcc -I /c/MPICH2/include/ test.c -L/c/MPICH2/lib/ -lmpi

Since your testprogram depends on the mpi library you need to specify 
the library after your program because the linker goes from left to right.
> It seems that the library file libmpi.a is corrected specified, 
> because if I change it to -lmpi1 it will report
> c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: 
> cannot find -lmpi1
> collect2: ld returned 1 exit status
> 2) My less successful attempt was on a Win64 (Vista64) platform with 
> MingW + gcc4.3:
> I tried installing the mpich2-1.0.8-win-x86-64.msi. but
> a) after the installation, I couldn't find libmpi.a in MPICH2\lib 
> folder as I was able to in case 1).b) when I am compiling the toy test 
> program, I get many errors like this:
> In file included from test.c:1:
> c:/MPICH2/include/mpi.h:334: error: expected '=', ',', ';', 'asm' or 
> '__attribute__' before 'MPI_Aint'
> Is this a gcc4.x problem?

Did you take a look at mpi.h line 334? On Linux I can see typedef long 
MPI_Aint; . Could you compile with the -E flag to see the preprocessor 
output? Maybe something is overwriting long?

> Best
> T
> ------------------------------------------------------------------------
> From: jayesh at mcs.anl.gov
> To: leitingl at hotmail.com
> CC: mpich-discuss at mcs.anl.gov
> Subject: RE: [mpich-discuss] (no subject) - mingw
> Date: Tue, 2 Dec 2008 13:34:18 -0600
> Hi,
>  You could try installing MPICH2 on windows (from the installer 
> available at 
> http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads) 
> and compile your code and link with the gcc libs (*.a) provided with 
> the installation (MPICH2\lib directory).
> Regards,
> Jayesh
> ------------------------------------------------------------------------
> *From:* mpich-discuss-bounces at mcs.anl.gov 
> [mailto:mpich-discuss-bounces at mcs.anl.gov] *On Behalf Of *ting lei
> *Sent:* Tuesday, December 02, 2008 1:31 PM
> *To:* mpich-discuss at mcs.anl.gov
> *Subject:* [mpich-discuss] (no subject)
> Hi,
> This might be a newbie question.
> I see in this thread that people can compile MPICH2 with MingW. I tried that with MingW (gcc 4.3 and 3.4x) several times but 
> I was never able to get past the ./configure step. 
> /"I have compiled a C executable using the MPICH2 Windows libraries and //MinGW./"
> Could someone please give me some pointers how to compile such an executable?
> More specifically, do I have to compile MPICH2 itself from source using MinGW then use some program such as mpicc?? 
> or should I just compile a regular c program and run it with mpiexec.exe ?
> If I were to compile MPICH2 itself with MingW, what other packages do I need except the latest version of MingW?
> Many thanks for your help
> <http://clk.atdmt.com/MRT/go/127032869/direct/01/>
> ------------------------------------------------------------------------
> It’s the same Hotmail®. If by “same” you mean up to 70% faster. Get 
> your account now. 
> <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008>

More information about the mpich-discuss mailing list