2014-10-12 53 views
0

我目前嘗試編譯這些文件使用HDF5 我已直接鏈接和包括所有必要的(我認爲),但仍然編譯無法找到文件是需要編譯與HDF5:無法鏈接庫文件(fortran 90)

這是我的Makefile:

CC = h5cc 
FC = h5fc 
LD = h5fc 

FDEBUG = -std -g -traceback 
CFLAGS = -g -O0 -Wall -pedantic 
FFLAGS = -g -O0 -Wall -I$(H5DIR)/include -L$(H5DIR)/lib/libhdf5hl_fortran.a 
LDFLAGS = -I$(H5DIR)/include -L$(H5DIR)/lib/libhdf5hl_fortran.a 
#LDFLAGS = -I$(MKLROOT)/include -L$(MKLROOT) -mkl=sequential 
#  -opt-block-factor=16 -opt-prefetch=4 \ 

.SUFFIXES: 
.SUFFIXES: .c .f .f90 .F90 .o 

OBJS = timing.o \ 
     kinds.o \ 
     rw_matrix.o \ 

EXE = matmul_omp.exe 

all: $(EXE) 

$(EXE): $(OBJS) matmul_omp.o 
    $(LD) $(LDFLAGS) -o [email protected] $^ 

.f90.o: 
    -$(RM) -f $*.o $*.mod 
    $(FC) $(FFLAGS) -c $< 

.c.o: 
    $(CC) $(CFLAGS) -c $< 

.PHONEY: clean 
clean: 

這是錯誤:

h5fc -I/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/include -L/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/lib/libhdf5hl_fortran.a -o matmul_omp.exe timing.o matmul_omp.o 

gfortran: /usr/lib64/libhdf5hl_fortran.a: No such file or directory 
gfortran: /usr/lib64/libhdf5_hl.a: No such file or directory 
gfortran: /usr/lib64/libhdf5_fortran.a: No such file or directory 
gfortran: /usr/lib64/libhdf5.a: No such file or directory 

正如你所見,我直接鏈接libhdf5hl_fortran.a。但我不知道爲什麼錯誤是給不同的目錄/ usr/lib64/

+1

安裝了庫? 'H5DIR'的價值是什麼? – 2014-10-12 07:23:56

+1

包含('-I')和庫('-L')的路徑對我來說看起來都很奇怪。英特爾將文件包含在openmpi目錄中,這足夠公平,但它位於szip目錄內的zlib目錄內的jpeglib目錄中......您可以看到圖片。如果這些是正確的安裝是奇怪的,我並不感到驚訝的makefile找不到庫。所有這一切都是以喋喋不休的方式提出與@VladimirF相同的問題。 – 2014-10-12 09:37:54

+0

H5DIR = /curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/ 我在裏面查了目錄,我在那裏找到這些文件。問題仍然存在 – 2014-10-12 19:10:05

回答

1

我覺得你有幾件事情在這裏錯了。

如果您使用的是h5fc那麼您不需要添加所有include和lib路徑。這是幫助程序應用程序的重點。

您正在添加具有英特爾的路徑,但您的h5fc有GNU(gfortran)錯誤。

HDF5的gfortran構建看起來好像它沒有構建fortran綁定。

我會建議嘗試以下內容。使用完整路徑(如您已完成),但致電ifort而不是h5fc

ifort -I/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/include \ 
     -L/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/lib/libhdf5hl_fortran.a \ 
     -o matmul_omp.exe timing.o matmul_omp.o