fortran のプログラムを使いたいのですがコンパイルがうまくいきません
make file がうまくいっていないのでしょうか
liblary の場所を示すのがうまくいってないのでしょうか
OCCAM1Dというプログラムを使いたいです
windows10でlinuxのコマンドを使えるようにしてやっています。それがいけないのでしょうか
fortran
1 2コード# 3# Makefile for Occam1DCSEM 4# 5# Kerry Key 6# Scripps Institution of Oceanography 7# 8# 9 10#---------------------------------------------------- 11# Step 1: Specify your Fortran compiler (FC) and the 12# compiler optimization settings (FCFLAGS): 13#---------------------------------------------------- 14 15# 16# Intel Fortran compiler: 17# 18 #FC = ifort 19 20# Use this for faster runtime: 21# FCFLAGS = #-mmacosx-version-min=10.8 22 23# use -mmacosx-version-min=10.4 to create a portable executable 24 25# Use this for debugging source code: 26# FCFLAGS = -stand f03 -g -warn all -fstack-security-check -check all 27 28# 29# GFortran Compiler (its free!): 30# 31FC =/usr/bin/gfortran# /usr/local/bin/gfortran-4.2 /usr/local/bin/gfortran 32# 33# Use this for faster runtime: 34#FCFLAGS = -O2 -m64 # -mmacosx-version-min=10.4# 35 36# Use this for debugging source code: 37#FCFLAGS = -Wall -pedantic -std=f2003# 38 39#---------------------------------------------------- 40# OPTIONAL for compiling the mexDipole1D.f90 Matlab interface: 41# 42# MATLIBPATH = Path to the MatLab libraries used for 43# building the MatLab interfaces. 44# You also need to change the path hardcoded 45# in mexDipole1D.f90! 46# 47# MEXBIN,MEXINC = Path to specific folders in the Matlab program. 48# 49# 50# MATEXT = File extension required by MatLab to 51# recognize the MatLab mex function. 52# Platform dependent. 53# 54# Note that the MEXFLAGS variable needs either -cpp (for ifort) 55# or -x f95-cpp-input (for gfortran) to preprocess the include 56# directive in mexDipole1D.f90. 57# 58#---------------------------------------------------- 59 60#MATLABPATH = /Applications/MATLAB_R2015b.app# 61#MEXBIN = $(MATLABPATH)/bin/maci/ # 32 bit 62#MEXBIN = $(MATLABPATH)/bin/maci64/ # 64 bit# 63#MEXINC = $(MATLABPATH)/extern/include/# 64 65# don't forget to add the MATLABPATH to the include statement in mexDipole1D.f90 66 67 68#MATEXT = mexmaci64 # 64 bit Mac Matlab# 69# MATEXT = mexmaci # 32 bit Mac Matlab 70# MATEXT = dll # use this on PC 71 72# MEXFLAGS = # use nothing if you don't want the mex files. 73# MEXFLAGS = -x f95-cpp-input # use this with gfortran 74#MEXFLAGS = -cpp # use this with ifort# 75 76#---------------------------------------------------- 77# Step 2: Specify the location of your LAPACK and BLAS 78# libraries. These contain the linear algebra routines 79# used by CSEM1D and Occam. If you only want to compile 80# Dipole1D, you don't need these libraries. 81#---------------------------------------------------- 82 83# 84# LAPACK and BLAS codes: 85# 86# Download the latest Lapack library from netlib.org. 87# Compile the lapack using this: 88# "cd" to ./lapack-3.2.1 and make sure the file 89# make.inc lists the correct Fortran compiler for your machine. 90# Then type "make blaslib" and then "make lapacklib". 91# This makes the libraries libblas.a and liblapack.a, 92# which are linked in the following command: 93# 94#LIBS = /mnt/c/Users/EjimaHideaki/lapack-3.6.1 -lblas -llapack 95#LIBS=-L./lapack-3.6.1 -lblas -llapack 96LIBS=/usr/local/bin/libblas.a 97LIBS=/usr/local/bin/liblapack.a 98#LIBS=/usr/local/bin/liblapack.a 99# 100# On Mac OS X platforms, install Apple's developer tools. Then 101# all you need to get lapack and blas is this 102# command: 103# 104 #LIBS = -framework veclib 105#MKLPATH=$(MKLROOT)/lib# 106#WMKLINCLUDE=$(MKLROOT)/include# 107 108# Use the Intel Link Line advisor to get this write on your system: 109#https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor 110#LIBS = -L$(MKLPATH) -I$(MKLINCLUDE) -lmkl_intel_lp64 -lmkl_core -lm 111#LIBS = #-L${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl 112#LIBS=-L./lapack-3.6.1 -lblas -llapack 113 114# 115# You're done. You shouldn't need to change anything below here. 116# 117#---------------------------------------------------- 118# Build commands: 119#---------------------------------------------------- 120 121TARGETS= clean OCCAM1DCSEM DIPOLE1D # mexDipole1D 122 123OBJSOC= FilterModules.o Occam.o \ 124 Dipole1D.o CSEM1D.o RunOccam.o 125 126OBJSDP= FilterModules.o Dipole1D.o CallDipole1D.o 127 128OBJSMEX= FilterModules.o Dipole1D.o mexDipole1D.o 129 130MEXlibs = -L$(MEXBIN) -I$(MEXINC) -lmx -lmex -lmat \ 131 132 133all: $(TARGETS) 134 135clean: clean_msg 136 rm -f *.o *~ core *.mod 137 rm -f OCCAM1DCSEM 138 rm -f DIPOLE1D 139 rm -f *.$(MATEXT) 140 141 142OCCAM1DCSEM: build_msg_occ $(OBJSOC) 143 $(FC) $(FCFLAGS) -o $@ $(OBJSOC) $(LIBS) 144 145DIPOLE1D: build_msg_dp $(OBJSDP) 146 $(FC) $(FCFLAGS) -o $@ $(OBJSDP) 147 148mexDipole1D: build_msg_dpmx $(OBJSMEX) 149 $(FC) $(FCFLAGS) $(MEXlibs) -DMATLAB_MEX_FILE -undefined dynamic_lookup -nofor_main -bundle -o $@.$(MATEXT) $(OBJSMEX) 150 151 152# 153# Compile rules 154# 155 156# General Fortran compile: 157%.o: %.f90 158 $(FC) $(FCFLAGS) -c -o $@ $^ 159 160# Fortran compile with Matlab Mex libraries: 161$(OBJSMEX): %.o: %.f90 162 $(FC) $(FCFLAGS) $(MEXFLAGS) -c -o $@ $^ 163 164# 165# Build Messages: 166# 167clean_msg: 168 @printf "#\n# Cleaning files: \n#\n" 169 170build_msg_occ: 171 @printf "#\n# Building OCCAM1DCSEM: \n#\n" 172 173build_msg_dp: 174 @printf "#\n# Building DIPOLE1D: \n#\n" 175 176build_msg_dpmx: 177 @printf "#\n# Building mexDipole1D: \n#\n" 178
コンパイルの結果の途中がこのようになります
また
エラーが出てしまいます
collect2: error: ld returned 1 exit status
make: *** [OCCAM1DCSEM] エラー 1
/usr/local/bin/liblapack.a(dgesvd.o): ������ dgesvd_' ���: dgesvd.f:(.text+0xbe2):
dgemm_' ������������������������������������������������
dgesvd.f:(.text+0x15aa): dgemm_' ������������������������������������������������ dgesvd.f:(.text+0x26da):
dgemm_' ������������������������������������������������
dgesvd.f:(.text+0x2c9a): dgemm_' ������������������������������������������������ dgesvd.f:(.text+0x377a):
dgemm_' ������������������������������������������������
/usr/local/bin/liblapack.a(dgesvd.o):dgesvd.f:(.text+0x49ad): dgemm_' ������������������������������������������������������������������������ /usr/local/bin/liblapack.a(dgetrf.o): ������
dgetrf_' ���:
dgetrf.f:(.text+0x3cb): dtrsm_' ������������������������������������������������ dgetrf.f:(.text+0x4a2):
dgemm_' ������������������������������������������������
/usr/local/bin/liblapac