Error during compiling

I have a 2 node cluster each with an Intel® Xeon™ CPU 3.20GHz
processor. I recently installed Rocks 4.3 i386 on my cluster, after
that, today I installed PGI CDK 9.0 linux86 on it.
CDK Installation went smoothly, but during compiling of my mpi code on
master node it is showing the following error.

$/usr/bin/ld: cannot find -lmpichf90

Is this a issue of x86 and i386 difference?

Please help me.



Hi Vighnesh,

What driver are you using to link? mpif90 or pgf90? If it’s pgf90 do you have “-L/full/path/to/mpich/library” on your link line? Does the library exist in this directory?

  • Mat

Hi Mat,
I am using mpirun driver and default directory for PGI installation is /opt/pgi.
I used following command for compiling

/op/pgi/linux86/9.0/mpi/mpich/bin/mpif90 code.f -o code.exe

Thanks and Regards,

Hi Vighnesh,

My best guess is that you don’t have the environment variable “PGI” set to “/op/pgi”. The mpi drivers use this variable to determine where the root of the PGI tree is located.

If you do have $PGI set correctly, I’d like to see what’s being passed to the linker. Can you post the output of the following commands using the verbose ("-v") flag?

/op/pgi/linux86/9.0/mpi/mpich/bin/mpif90 code.f -c -o code.o
/op/pgi/linux86/9.0/mpi/mpich/bin/mpif90 code.o -v -o code.exe


Dear Mat,
Following is the output as you asked.

$ /opt/pgi/linux86/9.0/mpi/mpich/bin/mpif90 code.f -c -o code.o
$ /opt/pgi/linux86/9.0/mpi/mpich/bin/mpif90 code.o -v -o code.exe
/usr/bin/ld /usr/lib/crt1.o /usr/lib/crti.o /opt/pgi/linux86/9.0-3/lib/trace_init.o /usr/lib/gcc/i386-redhat-linux/3.4.6/crtbegin.o /opt/pgi/linux86/9.0-3/lib/f90main.o -m elf_i386 -dynamic-linker /lib/ /opt/pgi/linux86/9.0-3/lib/pgi.ld -L/opt/pgi/linux86/9.0/mpi/mpich/lib -L/opt/pgi/linux86/9.0-3/lib -L/usr/lib -L/usr/lib/gcc/i386-redhat-linux/3.4.6 chax.o -lmpichf90 -lmpich -lpthread -lrt -rpath /opt/pgi/linux86/9.0-3/lib -o chax.exe -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgsse1 -lpgsse2 -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/i386-redhat-linux/3.4.6/crtend.o /usr/lib/crtn.o

Thanks and Regards,

Hi Mat,
Never mind I didnt set PGI environment variable correctly, After including “PGI=/opt/pgi export PGI” in my .bash_profile , it worked.
It was a great help from you.

Thanks and Regards,