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

Jayesh Krishna jayesh at mcs.anl.gov
Wed Oct 29 09:24:05 CDT 2008


Hi,
 The size of libmpi.a installed on your machine should not be 0KB.
Uninstall/Re-install MPICH2 on your machine.
 Please find below a simple command to compile helloworld.c using cygwin
gcc and the gcc libs installed with MPICH2 installation on windows,
 
===============================================================
gcc -I /cygdrive/c/progra~1/MPICH2/include -L
/cygdrive/c/progra~1/MPICH2/lib helloworld.c -lmpi
===============================================================
 
 Let us know if you still have problems compiling your MPI program.
 
Regards,
Jayesh
 

  _____  

From: mpich-discuss-bounces at mcs.anl.gov
[mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Manal Helal
Sent: Wednesday, October 29, 2008 1:41 AM
To: Dmitri Chubarov
Cc: mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] need to compile unix code as windows exe


Thank you for your reply, 

sorry for not trying that, I always link with mpicc, but it is  not
working under cygwin so far, 

I tried gcc -lmpi, it seems working better but I think the 0 kb libmpi.a
problem is the one now, 

here is the output:

**************************
/cygdrive/f/Program Files/MPICH2/lib/libmpi.a: file not recognized: File
truncat
ed
collect2: ld returned 1 exit status
**************************

I tried repairing the windows mpich2, but the file didn't change, and I
unisiatlled and removed the Program Files/MPICH2, and still the file size
is 0 kb, and the same output when linking with gcc

please advise, 

thank you very much, 

Manal


2008/10/29 Dmitri Chubarov <dmitri.chubarov at gmail.com>


Normally you should specify -lmpi on the command line to link against
libmpi.a the same holds for libmpich.a (-lmpich) or libm.a (-lm).
That's a decades old UNIX convention. Would you please try that.


On Wed, Oct 29, 2008 at 11:57 AM, Manal Helal <manalorama at gmail.com>
wrote:
> Hello
>
> I tried the following from the configure script, just to create the
> references for the windows installation:
>
> ln -s libmpich.a libmpi.a
> ln -s libmpich.so.1 libmpi.so.1
>
> I just also found that the windows mpich2 installation installed a 0 kb
> libmpi.a in the "Program Files\MPICH2\lib" path?!
>
> I think I am on the wrong direction all together, please help,
>
> Kind Regards,
>
> Manal
>
>
> 2008/10/29 Manal Helal <manalorama at gmail.com>
>>
>> I think I can make the gcc compiler see the mpi.h by adding the -I
>> argument and the folder of the mpi.h and similarly the -L to the
library
>> path, this compiled the code with no problems.
>>
>> However it is not linking to libmpi or libmpi.a, giving me the
following
>> errors:
>>
>> *********************************************************
>> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
>> cannot find
>>  -libmpi.a
>> collect2: ld returned 1 exit status
>> *********************************************************
>>
>> this happens when I use -libmpi or -libmpi.a in the gcc command
>>
>> I think this has to do with the library reference name not defined to
link
>> with, I am not sure how to solve this, google gives me general
explanation
>> on library names,
>>
>> I am not sure if I should post this in gcc or linux forums, but I hope
>> someone here could help,
>>
>> thanks again,
>>
>> Manal
>>
>> 2008/10/28 Jayesh Krishna <jayesh at mcs.anl.gov>
>>>
>>> Hi,
>>>  There are two ways you can compile your MPI program using MPICH2 on
>>> windows,
>>>
>>> 1. Install MPICH2 on windows
>>> # Use MS Visual Studio compiler to compile your MPI source to generate
an
>>> exe (Use mpi.lib while linking).
>>> # Use gcc from cygwin to compile your MPI source (Use libmpi.a while
>>> linking).
>>>
>>> 2. Configure/make/install MPICH2 on Cygwin
>>>
>>> # Use the mpicc script after installing MPICH2 to compile your MPI
>>> program.
>>>
>>>  Let us know if you need further information.
>>>
>>> Regards,
>>> Jayesh
>>> ________________________________
>>> From: owner-mpich-discuss at mcs.anl.gov
>>> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Manal Helal
>>> Sent: Sunday, October 26, 2008 11:31 PM
>>> To: mpich-discuss at mcs.anl.gov
>>> Subject: [mpich-discuss] need to compile unix code as windows exe
>>>
>>> Hi
>>>
>>> I need to compile Unix code under windows generating an exe file. I
>>> downloaded cygwin with gcc and make (that what I use on Solaris and
Linux
>>> flavors) , and downloaded mpich2 for windows which didn't contain
mpicc this
>>> is what I use in my make files.
>>>
>>> Will you please advise on the easiest efficient way to compile Unix
code
>>> on a windows platform and link to mpich in the compilation process?
sorry if
>>> it is a basic question, I searched google, and couldn't get an easy
step by
>>> step tutorial that covers all requirements.
>>>
>>> Thank you very much in advance,
>>>
>>> Kind Regards,
>>>
>>> Manal
>>
>
>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20081029/82c67d45/attachment.htm>


More information about the mpich-discuss mailing list