1

I'm on 16.04. When I

sudo apt-get install mpich

and check the lib directory

/usr/lib/mpich

it contains the include dir as expected, but the lib directory within it:

/usr/lib/mpich/lib

is a symbolic link to:

/usr/lib/x86_64-linux-gnu

So as far as I can tell, there are no lib files and I can't compile code because it doesn't find the mpich libraries.

/usr/lib/mpich$ readlink -f lib

Returns:

/usr/lib/x86_64-linux-gnu

Here are the compilation and link commands:

ifort -warn none -O2 -I/usr/include/mpich/ -c boundary.F90 -o boundary.o

ifort -o boundary.o -lmpi

and the error is:

boundary.F90:(.text+0xaa): undefined reference to `mpi_sendrecv_'

and the link directory is

/usr/include/mpich/lib

2
  • 1
    Based on the error message, the issue is not that mpich is not installed correctly, but that you are failing to link the necessary library for the function in question (which appears to be libmpichfort i.e. you need to add -lmpichfort to your link command) Commented Jul 2, 2018 at 3:17
  • That fixed it, if you want to add that as an answer I'll mark as correct. Strange though, as I've been using -lmpi for years on 14.04.
    – kotozna
    Commented Jul 2, 2018 at 3:30

1 Answer 1

3

The mpich package only contains the program binaries necessary to run MPICH programs.

You will need to install the libmpich-dev package which includes the MPICH headers and static libraries, as well as the compiler wrappers needed to build MPICH programs.


Based on the error message you provided, the issue is not that mpich is not installed correctly, but that you are failing to link the necessary library for the function in question, which appears to be libmpichfort

i.e. you need to add

-lmpichfort 

to your link command.

1
  • I already have libmpich-dev installed
    – kotozna
    Commented Jul 2, 2018 at 2:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .