error while compiling :"/usr/bin/ld: cannot find -lmpic

Hi,

error:

/usr/bin/ld: cannot find -lmpichf90

I am new to parallel processing with MPI. I am having a problem with similar error msg as a previous post (the bottom has the log file with the error msg):

http://www.pgroup.com/userforum/viewtopic.php?t=1589&postdays=0&postorder=asc&start=0

I tried his solution but the problem persists.

I use “pgf90” and “mpif90” wrapper. Following are their locations:

$ which mpif90
/usr/bin/mpif90



$ which pgf90
/opt/pgi/linux86-64/6.1/bin/pgf90

I also see folders named “mpich.pgi” and “mpich2.pgi” located in folder “/opt”.

I did some googling and am guessing maybe the file “libmpichf90” is missing…

I then ran “/sbin/ldconfig -p” command, and got the following from the list:

libmpichf90nc.so.2 (libc6,x86-64) => /usr/lib64/libmpichf90nc.so.2
	libmpichf90nc.so.2 (libc6) => /usr/lib/libmpichf90nc.so.2
	libmpichf90nc.so (libc6,x86-64) => /usr/lib64/libmpichf90nc.so
	libmpichf90nc.so (libc6) => /usr/lib/libmpichf90nc.so
	libmpichf90.so.2 (libc6,x86-64) => /usr/lib64/libmpichf90.so.2
	libmpichf90.so.2 (libc6) => /usr/lib/libmpichf90.so.2
	libmpichf90.so (libc6,x86-64) => /usr/lib64/libmpichf90.so
	libmpichf90.so (libc6) => /usr/lib/libmpichf90.so
	libmpich.so.2 (libc6,x86-64) => /usr/lib64/libmpich.so.2
	libmpich.so.2 (libc6) => /usr/lib/libmpich.so.2
	libmpich.so (libc6,x86-64) => /usr/lib64/libmpich.so
	libmpich.so (libc6) => /usr/lib/libmpich.so

The following is the log file with error msg:

$ ./Make.com
cd /home/xy/HYCOM/hycom/ATLb2.00/src_2.1.03_22_mpi
setenv ARCH intel
setenv MPICH_F90 /opt/pgi/linux86-64/6.1/bin/pgf90
setenv PGI /opt/pgi
setenv TYPE `echo $cwd | awk -F"_" '{print $NF}'`
echo /home/xy/HYCOM/hycom/ATLb2.00/src_2.1.03_22_mpi
awk -F_ {print $NF}
if ( ! -e ../config/intel_mpi ) then
make hycom ARCH=intel TYPE=mpi
mpif90 -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -g -fast -byteswapio -r8 -c mod_xc.F
mpif90 -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -g -fast -byteswapio -r8 -c mod_za.F
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 867)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 867)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 868)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 868)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 886)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 886)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 887)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 887)
  0 inform,   8 warnings,   0 severes, 0 fatal for zaiord
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1157)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1157)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1158)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1158)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1177)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1177)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1178)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1178)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1197)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1197)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1198)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1198)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1212)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1212)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1213)
PGF90-W-0093-Type conversion of expression performed (mod_za.F: 1213)
  0 inform,  16 warnings,   0 severes, 0 fatal for zaiowr
mpif90 -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -g -fast -byteswapio -r8 -c mod_pipe.F
mpif90             -g -fast -byteswapio -r8 -c hycom.f
mpif90             -g -fast -byteswapio -r8 -c archiv.f
mpif90             -g -fast -byteswapio -r8 -c barotp.f
mpif90             -g -fast -byteswapio -r8 -c bigrid.f
mpif90             -g -fast -byteswapio -r8 -c blkdat.f
mpif90             -g -fast -byteswapio -r8 -c cnuity.f
mpif90             -g -fast -byteswapio -r8 -c convec.f
mpif90             -g -fast -byteswapio -r8 -c diapfl.f
mpif90             -g -fast -byteswapio -r8 -c dpthuv.f
mpif90             -g -fast -byteswapio -r8 -c dpudpv.f
mpif90             -g -fast -byteswapio -r8 -c forfun.f
mpif90             -g -fast -byteswapio -r8 -c geopar.f
mpif90             -g -fast -byteswapio -r8 -c hybgen.f
mpif90             -g -fast -byteswapio -r8 -c icloan.f
mpif90             -g -fast -byteswapio -r8 -c inicon.f
mpif90             -g -fast -byteswapio -r8 -c inikpp.f
mpif90             -g -fast -byteswapio -r8 -c inimy.f
mpif90             -g -fast -byteswapio -r8 -c latbdy.f
mpif90             -g -fast -byteswapio -r8 -c matinv.f
mpif90             -g -fast -byteswapio -r8 -c momtum.f
mpif90             -g -fast -byteswapio -r8 -c mxkprf.f
PGF90-W-0093-Type conversion of expression performed (mxkprf.f: 786)
PGF90-W-0093-Type conversion of expression performed (mxkprf.f: 786)
  0 inform,   2 warnings,   0 severes, 0 fatal for mxkppaij
mpif90             -g -fast -byteswapio -r8 -c mxkrt.f
mpif90             -g -fast -byteswapio -r8 -c mxkrtm.f
mpif90             -g -fast -byteswapio -r8 -c mxpwp.f
mpif90             -g -fast -byteswapio -r8 -c overtn.f
mpif90             -g -fast -byteswapio -r8 -c poflat.f
mpif90             -g -fast -byteswapio -r8 -c prtmsk.f
mpif90             -g -fast -byteswapio -r8 -c psmoo.f
mpif90             -g -fast -byteswapio -r8 -c restart.f
mpif90             -g -fast -byteswapio -r8 -c stencl.f
mpif90             -g -fast -byteswapio -r8 -c thermf.f
mpif90             -g -fast -byteswapio -r8 -c trcupd.f
mpif90             -g -fast -byteswapio -r8 -c tsadvc.f
mpif90             -g -fast -byteswapio -r8 -c zebra.f
mpif90 -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -g -fast -byteswapio -r8 -c machine.F
mpif90 -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -g -fast -byteswapio -r8 -c wtime.F
gcc -DIA32 -DREAL8 -DMPI -DSERIAL_IO -DTIMER -O   -c machi_c.c
mpif90  -g -fast -byteswapio -r8 -Wl,-Bstatic -o hycom  mod_xc.o mod_za.o mod_pipe.o hycom.o archiv.o  barotp.o bigrid.o  blkdat.o cnuity.o convec.o diapfl.o dpthuv.o  dpudpv.o forfun.o  geopar.o hybgen.o icloan.o inicon.o  inikpp.o  inimy.o  latbdy.o matinv.o momtum.o  mxkprf.o  mxkrt.o  mxkrtm.o  mxpwp.o overtn.o poflat.o  prtmsk.o  psmoo.o restart.o stencl.o thermf.o trcupd.o  tsadvc.o  zebra.o machine.o  wtime.o machi_c.o 
/usr/bin/ld: cannot find -lmpichf90
make: *** [hycom] Error 2
endif

I really appreciate if someone can help me.
Thanks a lot.

Mike Y.

Hi Mike,

You are tryng to link statically (-Wl,-Bstatic) but your MPICH library is a shared object (.so). You’ll either need to find a static libmpichf90.a library, or remove the -Wl,-Bstatic option.

Hope this helps,
Mat

Hi Mat,

you are a life saver! It worked by deleting “-Wl, -Bastatic”.

Thanks a million.

Mike Y.