[mpich-discuss] question regarding compiling/linking under MingW (MPICH2 1.08)
Jayesh Krishna
jayesh at mcs.anl.gov
Mon Jan 5 16:55:15 CST 2009
Hi,
Glad to know MPICH2+MingW is working for you in 32-bit windows.
There are two ways to fix your problem with MPICH2+MingW on 64-bit
windows,
1) Use 32-bit version of MPICH2 on your 64-bit windows machine (Uninstall
any 64-bit version of MPICH2 before you install 32-bit version of MPICH2).
AFAIK Cygwin distributions are 32-bit and we provide default support for
Cygwin+gcc on 32-bit platforms only.
2) Let us know if you want to build 64-bit binaries using MPICH2+MingW
(The defns for windows fixed width ints - __int* - is in _mingw.h, which
is included by all MingW header files. So include <sys/types.h> before
including "mpi.h" and you should be able to get rid of errors with
undefined MS-extended types. However we don't ship the gcc libs, *.a, with
64-bit version of MPICH2. Let me know if you need them.).
If you want to compile MPICH2 on windows (without using Visual Studio
compiler) try compiling MPICH2 using Cygwin. Let us know if it works for
you (We regularly test MPICH2+Cygwin. You won't have the problem with
unsupported poll() if you use Cygwin - Cygwin libs do the abstraction for
you.).
Let us know the results.
Regards,
Jayesh
_____
From: mpich-discuss-bounces at mcs.anl.gov
[mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of ting lei
Sent: Sunday, January 04, 2009 5:46 PM
To: mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] question regarding compiling/linking under
MingW (MPICH2 1.08)
Hi,
Thanks a lot for your reply.
I just read an infinitely long post that discusses whether __int64 is
dead, and realized that I get into something taboo regarding ms specific
vs c99.
There is a lot of discussion of aethetics there, ..., to no avail though.
Just for the sake of the problem, I used the binary distribution for
Win64. Below is my MPICH2/lib
$ ls /c/MPICH2/lib/
TraceInput.lib fmpe.lib irlog2rlog.lib mpi.lib
cxx.lib fmpich2.lib mpe.lib rlog.lib
In the win32 version, I did see libmpi.a in the same folder. But I tried
removing that file, and was able to compile and link.
My last effort was to use
typedef long long MPI_Aint
and go back to mingw+gcc3.4.5+vista64, and the error message was:
$ gcc -I /c/MPICH2/include/ test.c -L /c/MPICH2/lib/ -lmpi
C:/Users/ting/AppData/Local/Temp/cciBiEaP.o:test.c:(.text+0x38): undefined
reference to `MPI_Init'
C:/Users/ting/AppData/Local/Temp/cciBiEaP.o:test.c:(.text+0x4b): undefined
reference to `MPI_Comm_rank'
collect2: ld returned 1 exit status
As a side note, I tried to compile one from source using mingw under
Win64,
but it was complaining about missing poll() function etc. Somebody
complained in a MingW list, but a mingw person believes that MPI under
windows shouldn't
use poll() anyways. I tried to add some other code downloaded from the
internet that fakes a poll(), then I got a problem with threads. And I
realized that the job is
beyond a novice like me.
Thanks again for your help,
hope some day this problem will disappear. But maybe the mingw idea was
wrong -- a minimal set of unix functions with native winxx impl. Lovely
little piece that brings
unix to the dull windows command line though.
T.
> Date: Sun, 4 Jan 2009 20:21:42 +0100
> From: ddkrause at uni-bonn.de
> To: mpich-discuss at mcs.anl.gov
> Subject: Re: [mpich-discuss] question regarding compiling/linking under
MingW (MPICH2 1.08)
>
> Hi,
>
> ting lei wrote:
> > *Hi, Dorian*
> >
> > Thanks a lot for your prompt reply.
> > Your command line
> > > gcc -I /c/MPICH2/include/ test.c -L/c/MPICH2/lib/ -lmpi
> > solves the first problem perfectly on win32.
>
> Good to hear.
>
> >
> > On Win64, I see the following from line 333 onwards about MPI_Aint
> > "
> > /* Definitions that are determined by configure. */
> > typedef __int64 MPI_Aint;
> > typedef int MPI_Fint;
> > #define MPI_AINT_FMT_DEC_SPEC "%I64d"
> > #define MPI_AINT_FMT_HEX_SPEC "%I64x"
> > "
> > It seems that configure made a choice of __int64 for the Win64 package
> > instead of long under linux. Any idea how this might be solved?
> > I have also attached the output with the -E option in the attachment
> > err.txt for your reference.
> > BTW, I tried to manually change
> > typedef __int64 MPI_Aint;
> > to
> > typedef long MPI_Aint;
> > and then, I got:
> > gcc -I /c/MPICH2/include/ test.c -L /c/MPICH2/lib/ -lmpi
> > test.c: In function 'main':
> > test.c:15: warning: incompatible implicit declaration of built-in
> > function 'printf'
> > C:/Users/ting/AppData/Local/Temp/ccsAr9gj.o:test.c:(.text+0x22):
> > undefined reference to `_MPI_Init'
> > C:/Users/ting/AppData/Local/Temp/ccsAr9gj.o:test.c:(.text+0x36):
> > undefined reference to `_MPI_Comm_rank'
> > collect2: ld returned 1 exit status
> >
> > or the following for using g++:
> >
> > $ g++ -I /c/MPICH2/include/ test.c -L /c/MPICH2/lib/ -lmpi
> > C:/Users/ting/AppData/Local/Temp/ccPO9opx.o:test.c:(.text+0x22):
> > undefined reference to `_MPI_Init'
> > C:/Users/ting/AppData/Local/Temp/ccPO9opx.o:test.c:(.text+0x36):
> > undefined reference to `_MPI_Comm_rank'
> > collect2: ld returned 1 exit status
> >
>
> You said that you downloaded the binary distribution, correct? I have no
> experiences with MPICH2 on Windows
> but I would suspect that the libraries were build with Microsofts C/C++
> compiler cl and on Win64 the MingGW gcc
> compiler and cl are not compatible. __int64 is a Microsoft specific
> extension to C/C++
(http://msdn.microsoft.com/en-us/library/29dh1w7z.aspx).
> Also it seems that gcc does some sort of name-mangling (adding an
> underscore to the function name). This is rather strange
> for a C compiler...
>
> Probably you'r right that its a gcc 4.3 issue. Maybe some else has more
> insight into this.
>
> Interestingly he doesn't say that he can't find libmpi.a. Are you sure
> that it is not there?
>
> BTW: typedef long MPI_Aint might be a problem because sizeof(long) = 4
> on Windows at least with the Microsoft compiler. Don't know what
> gcc does in this situation.
>
> Dorian
>
> >
> >
> > Thanks again.
> >
> > T.
> >
> >
> > > Date: Sun, 4 Jan 2009 18:29:23 +0100
> > > From: ddkrause at uni-bonn.de
> > > To: mpich-discuss at mcs.anl.gov
> > > Subject: Re: [mpich-discuss] question regarding compiling/linking
> > under MingW (MPICH2 1.08)
> > >
> > > Hi
> > >
> > > 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=down
loads)
> >
> > > > 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 HotmailR. If by "same" you mean up to 70% faster.
Get
> > > > your account now.
> > > >
> >
<http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad
1_122008>
> > >
> >
> >
------------------------------------------------------------------------
> > Send e-mail faster without improving your typing skills. Get your
> > HotmailR account.
> >
<http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed
_122008>
>
_____
Life on your PC is safer, easier, and more enjoyable with Windows VistaR.
See how <http://clk.atdmt.com/MRT/go/127032870/direct/01/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090105/ac593fb7/attachment.htm>
More information about the mpich-discuss
mailing list