3

I have a fortran code (pardiso_1.f) and it needs some libraries (BLAS, lapack and Pardiso libraries) to be compiled. When I try to compile it, I link libraries before compilation and I write this line in linux terminal:

gfortran pardiso_1.f -L/home/behnam/Pardiso -lpardiso412-GNU450-X86-64 -L/usr/lib -lblas -llapack -fopenmp 

and it works perfectly.

However I have to run the code using makefile. I am so new in writing makefiles and I do not know how to do the linkage. I have written this makefile. could anyone help me to find out what is wrong with that?

FC = gfortran OPT = -O2 PROGRAMS = pardiso_1 all: $(PROGRAMS) FFLAGS = -fopenmp #### BLAS, LAPACK and PTHREAD libraries LBLAS = /usr/lib/ ###location of pardiso file LIBMKL = /home/behnam/PS2/ #### Series of libraries LIBRARIES= -llapack -lblas -lpthread -lm -lpardiso412-GNU430-X86-64 PATHFC = /usr/bin/ nlace: ${PATHFC}${FC} ${OPT} ${FFLAGS} -I${PROGRAMS} -o nlace.exe \ -L${LIBMKL} -lpardiso412-GNU430-X86-64\ -L${LBLAS} ${LIBRARIES} clean: rm -f *.o *.exe fort.* *~ *.mod veryclean: clean rm -f *~ $(PROGRAMS) 

The errors are:

behnam@meen-392430:~/testing$ make make: Warning: File `Makefile' has modification time 23 s in the future gfortran -fopenmp pardiso_1.f -o pardiso_1 /tmp/ccYNexaH.o: In function `MAIN__': pardiso_1.f:(.text+0xb3): undefined reference to `pardisoinit_' pardiso_1.f:(.text+0x2ae): undefined reference to `pardiso_chkmatrix_' pardiso_1.f:(.text+0x36e): undefined reference to `pardiso_chkvec_' pardiso_1.f:(.text+0x44c): undefined reference to `pardiso_printstats_' pardiso_1.f:(.text+0x5ae): undefined reference to `pardiso_' pardiso_1.f:(.text+0x860): undefined reference to `pardiso_' pardiso_1.f:(.text+0xb78): undefined reference to `pardiso_' pardiso_1.f:(.text+0xe00): undefined reference to `pardiso_' collect2: ld returned 1 exit status make: *** [pardiso_1] Error 1 

2 Answers 2

1

Your makefile does not contain the -L/home/behnam/Pardiso part of your command line.

Sign up to request clarification or add additional context in comments.

2 Comments

/home/behnam/PS2/ is the same as /home/behnam/Pardiso
@behnamm: look at your error code. Note how it says, gfortran -fopenmp pardiso_1.f -o pardiso_1 and does not include -L/home/behnam/PS2?
0

Your rule for PROGRAMS does not contain a recipe that includes the library calls. I presume you want something like your nlace rule, but right now, make is not calling any of your -L switches as part of its operation.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.