[MPICH] Problem in linking a C program with MPI Libraries

vikas bhardwaj vikas21 at gmail.com
Mon Apr 3 06:43:08 CDT 2006

Hi ,
I am using mpich 1.2.7, and installing mpi flavor of Globus 4.0.1 in order
to install mpich G2.
I am using via as device in mpid

The installation is successful but for globus the libraries should be shared
so to make all the libraries shared I am configuring mpich with
"--enable-sharedlib" flag.

After this there was no problem regarding the installation but i was not
getting "libmpich.so" inside "lib/" directory or 'lib/shared/"

-> I think the reason was "inside mpid/via in Makefile only ar crl is used
that is creating libmpich.a only"

so i manualy created the libmpich.so by passing all the object files using

gcc -shared .......(all .o files ).......-o lib/libmpich.so

the libmpich.so got created successfully

But when i try to compile any of the C program using bin/mpicc i get
following error :

"Could not link a C program with MPI libraries"

For cheking the library link i run

$ make linktest

and the output is as follows"

make overtake
/home/hmpi/mpich-1.2.7/mpich-1.2.7/bin/mpicc  -o overtake overtake.o test.o
/home/hmpi/mpich-1.2.7/mpich-1.2.7/lib/libmpich.so: undefined reference to
/home/hmpi/mpich-1.2.7/mpich-1.2.7/lib/libmpich.so: undefined reference to
collect2: ld returned 1 exit status
make[2]: *** [overtake] Error 1
make[1]: [linktest] Error 2 (ignored)
Could not link a C program with MPI libraries
make[1]: *** [linktest] Error 1
make: *** [linktest] Error 2

I am not able to understand why its not able to link with libmpich.so

Please tell me the exact way How i can create shared libraries "libmpich.so"
& use them ?

Please guide me

-Vikas Bhardwaj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20060403/aae398f3/attachment.htm>

More information about the mpich-discuss mailing list