Plaetean
Plaetean

Reputation: 163

Cannot find -mpich when using make

Trying to install this software, and having extracted the tarball, attemping to make I get the error:

/usr/bin/ld: cannot find -lmpich
collect2: error: ld returned 1 exit status
Makefile:162: recipe for target 'N-GenIC' failed

In the Makefile we have:

SYSTYPE="Chris@Adam"

FFTW_INCL = -I/usr/common/pdsoft/include
FFTW_LIBS = -L/usr/common/pdsoft/lib

CC       =   mpicc        # sets the C-compiler (default)
OPTIMIZE =   -O3 -Wall    # optimization and warning flags (default)
MPICHLIB =  -lmpich

#————————————— Adjust settings for target computer

ifeq ($(SYSTYPE),”Chris@Adam”)
CC = mpicc
OPTIMIZE = -O3 -Wall
GSL_INCL = -I/usr/local/include
GSL_LIBS = -L/usr/local/lib
FFTW_INCL= -I/usr/local/include
FFTW_LIBS= -L/usr/local/lib
MPICHLIB = -L/usr/lib
endif

...

LIBS   =   -lm  $(MPICHLIB)  $(FFTW_LIB)  $(GSL_LIBS)  -lgsl -lgslcblas

Now 2 things confuse me about this - I recently intalled GADGET2 which has an almost identical Makefile, also with:

SYSTYPE=”Chris@Adam”

#————————————— Adjust settings for target computer

ifeq ($(SYSTYPE),”Chris@Adam”)
CC = mpicc
OPTIMIZE = -O3 -Wall
GSL_INCL = -I/usr/local/include
GSL_LIBS = -L/usr/local/lib
FFTW_INCL= -I/usr/local/include
FFTW_LIBS= -L/usr/local/lib
MPICHLIB = -L/usr/lib
endif

...

LIBS   =   $(HDF5LIB) -g  $(MPICHLIB)  $(GSL_LIBS) -lgsl -lgslcblas -lm $(FFTW_LIB)

so what I don't understand is why is it fine to make GADGET2 but not the other package I'm trying to install? And what's causing the error? I have read some previous questions on this with similar errors and they suggest adding a symlink, but I can't even find where mpich is actually stored, the only executable or symlink i can find is mpicc.

Upvotes: 1

Views: 1256

Answers (1)

Wesley Bland
Wesley Bland

Reputation: 9062

If you're using the mpicc that's provided with MPICH, there's no need to add -lmpich your flags. The mpicc wrapper should take care of all of that for you. If you want to see what mpicc turns into, you can use mpicc -show.

Upvotes: 2

Related Questions