0

我正在尝试编译实验室伙伴给我的 fortran 代码以运行一些分析。该程序涉及调用 MATLAB 脚本来计算某些事情。他给我的文件被设置为在另一台计算机上运行,​​我正试图让它们在我的计算机上运行。我已将 ACML 和 MATLAB 库路径更改为我计算机上的相应路径。

我得到的错误是:

gfortran -v   -O2 -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnxa64 -L/opt/acml4.3.0/gfortran64/lib -lacml -lacml_mv -lgfortran -L/usr/local/MATLAB/R2012a/bin/glnxa64 -leng -lmx obj/gctad.mod.o obj/glrkn_functions.mod.o obj/glrkn.mod.o obj/tfe.mod.o obj/glrkn_ext.mod.o obj/tfe_readfile.mod.o obj/glrkn_readfile.mod.o obj/matlab.mod.o obj/partitions.mod.o obj/glrkn_preproc.o obj/glrkn_thrml_props.o obj/glrkn_init_logs.o obj/glrkn_press_init.o obj/glrkn_press_updt.o obj/glrkn_tmpr_init.o obj/glrkn_tmpr_updt.o obj/glrkn_ext_press_init.o obj/glrkn_ext_press_updt.o obj/glrkn_ext_tmpr_init.o obj/glrkn_ext_tmpr_updt.o obj/glrkn_dynamic.o obj/glrkn_el_log.o obj/glrkn_rk4.o obj/glrkn_nwmrk.o obj/glrkn_init_accel.o obj/sorti.o obj/tfe_preproc.o obj/tfe_reorder.o obj/tfe_mtxmk.o obj/tfe_ext_out_init.o obj/tfe_ext_flx_init.o obj/tfe_ext_out_updt.o obj/tfe_ext_flx_updt.o obj/tfe_flx_init.o obj/tfe_flx_updt.o obj/tfe_dynamic.o obj/tfe_tmpr_rate_init.o obj/panel_main.o -o main.out 
Driving: gfortran -v -O2 -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnxa64 -L/opt/acml4.3.0/gfortran64/lib -lacml -lacml_mv -l gfortran -l m -L/usr/local/MATLAB/R2012a/bin/glnxa64 -leng -lmx obj/gctad.mod.o obj/glrkn_functions.mod.o obj/glrkn.mod.o obj/tfe.mod.o obj/glrkn_ext.mod.o obj/tfe_readfile.mod.o obj/glrkn_readfile.mod.o obj/matlab.mod.o obj/partitions.mod.o obj/glrkn_preproc.o obj/glrkn_thrml_props.o obj/glrkn_init_logs.o obj/glrkn_press_init.o obj/glrkn_press_updt.o obj/glrkn_tmpr_init.o obj/glrkn_tmpr_updt.o obj/glrkn_ext_press_init.o obj/glrkn_ext_press_updt.o obj/glrkn_ext_tmpr_init.o obj/glrkn_ext_tmpr_updt.o obj/glrkn_dynamic.o obj/glrkn_el_log.o obj/glrkn_rk4.o obj/glrkn_nwmrk.o obj/glrkn_init_accel.o obj/sorti.o obj/tfe_preproc.o obj/tfe_reorder.o obj/tfe_mtxmk.o obj/tfe_ext_out_init.o obj/tfe_ext_flx_init.o obj/tfe_ext_out_updt.o obj/tfe_ext_flx_updt.o obj/tfe_flx_init.o obj/tfe_flx_updt.o obj/tfe_dynamic.o obj/tfe_tmpr_rate_init.o obj/panel_main.o -o main.out -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
Reading specs from /usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-v' '-O2' '-L/opt/acml4.3.0/gfortran64/lib' '-L/usr/local/MATLAB/R2012a/bin/glnxa64' '-o' 'main.out' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O2' '-L/opt/acml4.3.0/gfortran64/lib' '-L/usr/local/MATLAB/R2012a/bin/glnxa64' '-o' 'main.out' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.6/collect2 --sysroot=/ --build-id --no-add-needed --as-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o main.out /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o -L/opt/acml4.3.0/gfortran64/lib -L/usr/local/MATLAB/R2012a/bin/glnxa64 -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. -rpath-link /usr/local/MATLAB/R2012a/bin/glnxa64 -lacml -lacml_mv -lgfortran -lm -leng -lmx obj/gctad.mod.o obj/glrkn_functions.mod.o obj/glrkn.mod.o obj/tfe.mod.o obj/glrkn_ext.mod.o obj/tfe_readfile.mod.o obj/glrkn_readfile.mod.o obj/matlab.mod.o obj/partitions.mod.o obj/glrkn_preproc.o obj/glrkn_thrml_props.o obj/glrkn_init_logs.o obj/glrkn_press_init.o obj/glrkn_press_updt.o obj/glrkn_tmpr_init.o obj/glrkn_tmpr_updt.o obj/glrkn_ext_press_init.o obj/glrkn_ext_press_updt.o obj/glrkn_ext_tmpr_init.o obj/glrkn_ext_tmpr_updt.o obj/glrkn_dynamic.o obj/glrkn_el_log.o obj/glrkn_rk4.o obj/glrkn_nwmrk.o obj/glrkn_init_accel.o obj/sorti.o obj/tfe_preproc.o obj/tfe_reorder.o obj/tfe_mtxmk.o obj/tfe_ext_out_init.o obj/tfe_ext_flx_init.o obj/tfe_ext_out_updt.o obj/tfe_ext_flx_updt.o obj/tfe_flx_init.o obj/tfe_flx_updt.o obj/tfe_dynamic.o obj/tfe_tmpr_rate_init.o obj/panel_main.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
obj/panel_main.o: In function `MAIN__':
panel_main.f90:(.text+0x280): undefined reference to `engopen_'
panel_main.f90:(.text+0x2a6): undefined reference to `engevalstring_'
panel_main.f90:(.text+0x419): undefined reference to `engevalstring_'
panel_main.f90:(.text+0x42e): undefined reference to `engclose_'
obj/glrkn_ext_press_init.o: In function `glrkn_ext_press_init_':
glrkn_ext_press_init.f90:(.text+0x25): undefined reference to `enggetvariable_'
glrkn_ext_press_init.f90:(.text+0x41): undefined reference to `mxgetnumberofelements_'
glrkn_ext_press_init.f90:(.text+0x54): undefined reference to `mxgetm_'
glrkn_ext_press_init.f90:(.text+0x67): undefined reference to `mxgetn_'
glrkn_ext_press_init.f90:(.text+0x92): undefined reference to `mxcreatedoublematrix_'
glrkn_ext_press_init.f90:(.text+0xb8): undefined reference to `mxcreatedoublematrix_'
glrkn_ext_press_init.f90:(.text+0xd6): undefined reference to `mxcreatedoublescalar_'
glrkn_ext_press_init.f90:(.text+0x1d8): undefined reference to `mxgetpr_'
glrkn_ext_press_init.f90:(.text+0x1fb): undefined reference to `mxcopyptrtoreal8_'
glrkn_ext_press_init.f90:(.text+0x22a): undefined reference to `enggetvariable_'
glrkn_ext_press_init.f90:(.text+0x246): undefined reference to `mxgetnumberofelements_'
glrkn_ext_press_init.f90:(.text+0x259): undefined reference to `mxgetm_'
glrkn_ext_press_init.f90:(.text+0x26c): undefined reference to `mxgetn_'
glrkn_ext_press_init.f90:(.text+0x36e): undefined reference to `mxgetpr_'
glrkn_ext_press_init.f90:(.text+0x391): undefined reference to `mxcopyptrtoreal8_'
obj/glrkn_ext_press_updt.o: In function `glrkn_ext_press_updt_':
glrkn_ext_press_updt.f90:(.text+0x563): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0x587): undefined reference to `mxcopyreal8toptr_'
glrkn_ext_press_updt.f90:(.text+0x5a2): undefined reference to `engputvariable_'
glrkn_ext_press_updt.f90:(.text+0x5b7): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0x5da): undefined reference to `mxcopyreal8toptr_'
glrkn_ext_press_updt.f90:(.text+0x5f5): undefined reference to `engputvariable_'
glrkn_ext_press_updt.f90:(.text+0x60a): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0x62d): undefined reference to `mxcopyreal8toptr_'
glrkn_ext_press_updt.f90:(.text+0x648): undefined reference to `engputvariable_'
glrkn_ext_press_updt.f90:(.text+0x65d): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0x680): undefined reference to `mxcopyreal8toptr_'
glrkn_ext_press_updt.f90:(.text+0x69b): undefined reference to `engputvariable_'
glrkn_ext_press_updt.f90:(.text+0x6ba): undefined reference to `engevalstring_'
glrkn_ext_press_updt.f90:(.text+0x6d9): undefined reference to `enggetvariable_'
glrkn_ext_press_updt.f90:(.text+0x6f5): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0x718): undefined reference to `mxcopyptrtoreal8_'
glrkn_ext_press_updt.f90:(.text+0x724): undefined reference to `mxdestroyarray_'
glrkn_ext_press_updt.f90:(.text+0xc8a): undefined reference to `enggetvariable_'
glrkn_ext_press_updt.f90:(.text+0xca6): undefined reference to `mxgetpr_'
glrkn_ext_press_updt.f90:(.text+0xcc9): undefined reference to `mxcopyptrtoreal8_'
glrkn_ext_press_updt.f90:(.text+0xcd5): undefined reference to `mxdestroyarray_'
obj/tfe_ext_flx_init.o: In function `tfe_ext_flx_init_':
tfe_ext_flx_init.f90:(.text+0x1b): undefined reference to `enggetvariable_'
tfe_ext_flx_init.f90:(.text+0x37): undefined reference to `mxgetnumberofelements_'
tfe_ext_flx_init.f90:(.text+0x4a): undefined reference to `mxgetm_'
tfe_ext_flx_init.f90:(.text+0x5d): undefined reference to `mxgetn_'
tfe_ext_flx_init.f90:(.text+0x7a): undefined reference to `mxcreatedoublematrix_'
tfe_ext_flx_init.f90:(.text+0x99): undefined reference to `mxcreatedoublescalar_'
tfe_ext_flx_init.f90:(.text+0x19b): undefined reference to `mxgetpr_'
tfe_ext_flx_init.f90:(.text+0x1be): undefined reference to `mxcopyptrtoreal8_'
obj/tfe_ext_flx_updt.o: In function `tfe_ext_flx_updt_':
tfe_ext_flx_updt.f90:(.text+0x629): undefined reference to `mxgetpr_'
tfe_ext_flx_updt.f90:(.text+0x64d): undefined reference to `mxcopyreal8toptr_'
tfe_ext_flx_updt.f90:(.text+0x668): undefined reference to `engputvariable_'
tfe_ext_flx_updt.f90:(.text+0x67d): undefined reference to `mxgetpr_'
tfe_ext_flx_updt.f90:(.text+0x6a0): undefined reference to `mxcopyreal8toptr_'
tfe_ext_flx_updt.f90:(.text+0x6bb): undefined reference to `engputvariable_'
tfe_ext_flx_updt.f90:(.text+0x6d0): undefined reference to `mxgetpr_'
tfe_ext_flx_updt.f90:(.text+0x6f3): undefined reference to `mxcopyreal8toptr_'
tfe_ext_flx_updt.f90:(.text+0x70e): undefined reference to `engputvariable_'
tfe_ext_flx_updt.f90:(.text+0x723): undefined reference to `mxgetpr_'
tfe_ext_flx_updt.f90:(.text+0x746): undefined reference to `mxcopyreal8toptr_'
tfe_ext_flx_updt.f90:(.text+0x761): undefined reference to `engputvariable_'
tfe_ext_flx_updt.f90:(.text+0x780): undefined reference to `engevalstring_'
tfe_ext_flx_updt.f90:(.text+0x79f): undefined reference to `enggetvariable_'
tfe_ext_flx_updt.f90:(.text+0x7bb): undefined reference to `mxgetpr_'
tfe_ext_flx_updt.f90:(.text+0x7de): undefined reference to `mxcopyptrtoreal8_'
tfe_ext_flx_updt.f90:(.text+0x7ea): undefined reference to `mxdestroyarray_'
obj/tfe_dynamic.o: In function `tfe_dynamic_':
tfe_dynamic.f90:(.text+0x9c1): undefined reference to `dpbsv_'
obj/tfe_tmpr_rate_init.o: In function `tfe_tmpr_rate_init_':
tfe_tmpr_rate_init.f90:(.text+0x631): undefined reference to `dpbsv_'
collect2: ld returned 1 exit status
make: *** [run/panel_main.out] Error 1    

我正在使用的makefile是:

# object directory
obj_dir = obj/
# source directory
src_dir = src/
# Run directory
run_dir = run/
# Library directory

# library options
OPTLB = -L/opt/acml4.3.0/gfortran64/lib -lacml -lacml_mv -lgfortran \
-L/usr/local/MATLAB/R2012a/bin/glnxa64 -leng -lmx

# Linker options
OPTLN = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnxa64
# Preprocessing options
OPTPP = -cpp -D__linux -D__x86_64__
# Include options
OPTIN = -J$(obj_dir) -I/usr/local/MATLAB/R2012a/extern/include
# Optimization options
OPTOP = -O2
# Debuggion options
OPTDB = 

# Main file
main = panel_main

# module files (in proper order!)
modf = gctad glrkn_functions \
glrkn tfe glrkn_ext \
tfe_readfile glrkn_readfile \
matlab partitions

# Module names
mod = gctad glrkn_functions \
glrkn_ext_tmpr glrkn_ext_press \
glrkn_files glrkn_chk glrkn_amp glrkn_props \
glrkn_params glrkn_sol glrkn_dyn \
tfe_chk tfe_mat tfe_coord tfe_size tfe_prop \
tfe_time tfe_sol tfe_files tfe_amp tfe_ext_flx \
tfe_flx tfe_ext_out tfe_dyn \
tfe_readfile glrkn_readfile \
matlab partitions

# tfe files
tfe = sorti tfe_preproc tfe_reorder tfe_mtxmk \
tfe_ext_out_init tfe_ext_flx_init \
tfe_ext_out_updt tfe_ext_flx_updt \
tfe_flx_init tfe_flx_updt \
tfe_dynamic tfe_tmpr_rate_init 

# glrkn files
glrkn = glrkn_preproc glrkn_thrml_props glrkn_init_logs \
glrkn_press_init glrkn_press_updt \
glrkn_tmpr_init glrkn_tmpr_updt \
glrkn_ext_press_init glrkn_ext_press_updt \
glrkn_ext_tmpr_init glrkn_ext_tmpr_updt \
glrkn_dynamic glrkn_el_log glrkn_rk4 \
glrkn_nwmrk glrkn_init_accel

# MATLAB library location
matlib_dir = /usr/local/MATLAB/R2012a/bin/glnxa64/
matinc_dir = /usr/local/MATLAB/R2012a/extern/include/
matlibs = eng mx

# Sources and objects
glrkn_src = $(addprefix $(src_dir), $(addsuffix .f90, $(glrkn)))
glrkn_obj = $(addprefix $(obj_dir), $(addsuffix .o, $(glrkn)))
tfe_src = $(addprefix $(src_dir), $(addsuffix .f90, $(tfe)))
tfe_obj = $(addprefix $(obj_dir), $(addsuffix .o, $(tfe)))
mod_src = $(addprefix $(src_dir), $(addsuffix .mod.f90, $(modf)))
mod_obj = $(addprefix $(obj_dir), $(addsuffix .mod.o, $(modf)))
mod_mod = $(addprefix $(obj_dir), $(addsuffix .mod, $(mod)))
main_src = $(addprefix $(src_dir), $(addsuffix .f90, $(main)))
main_obj = $(addprefix $(obj_dir), $(addsuffix .o, $(main)))
main_out = $(addprefix $(run_dir), $(addsuffix .out, $(main)))
lib_opt = $(addprefix -l, $(libs))

# Concatenate
all_obj = $(mod_obj) $(glrkn_obj) $(tfe_obj) $(main_obj)

# Main executable
$(main_out) : $(all_obj)
    gfortran -v  $(OPTDB) $(OPTOP) $(OPTLN) $(OPTLB) $(all_obj) -o main.out 
    mv main.out $(main_out)

#   gfortran $(debug) -J$(obj_dir) $(all_obj) -L$(lib_dir) -L$(matlib_dir) -Wl,-rpath-link,$(matlib_dir) $(lib_opt)  $(addprefix -l, $(matlibs)) -o main.out
# Main object
$(main_obj) : $(main_src) $(mod_obj)
    gfortran -v $(OPTPP) $(OPTDB) $(OPTOP) $(OPTIN) $< -c
    mv $(notdir $@) $@

# TFE objects
$(tfe_obj) : $(obj_dir)%.o : $(src_dir)%.f90 $(mod_obj)
    gfortran -v $(OPTPP) $(OPTDB) $(OPTOP) $(OPTIN) $< -c
    mv $(notdir $@) $@

# Structure objects
$(glrkn_obj) : $(obj_dir)%.o : $(src_dir)%.f90 $(mod_obj)
    gfortran -v $(OPTPP) $(OPTDB) $(OPTOP) $(OPTIN) $< -c
    mv $(notdir $@) $@

# Module objects
$(mod_obj) : $(obj_dir)%.mod.o : $(src_dir)%.mod.f90 
    gfortran -v $(OPTPP) $(OPTOP) $(OPTDB) $(OPTIN) $< -c 
    mv $(notdir $@) $@

# Clean objects folder
.PHONY : clean
clean :
    rm -f -v $(obj_dir)*

我已经用谷歌搜索了这个废话并且没有任何运气来修复它。如果有人有任何想法让我尝试,我将不胜感激。

谢谢,扎克

4

2 回答 2

2

与最初制作它的人交谈。这是使用的 gfortran 版本的问题。我使用的是 gfortran 4.6.3。他说他上次成功使用时使用的是4.4.5。我安装了 gfortran 4.4 并且编译没有问题。关于我遇到的下一个问题!

于 2012-06-29T13:49:45.250 回答
0

为什么不将fortran转换为matlab?如果这可能有效,请在文件交换处查看 f2matlab。

于 2012-06-29T11:28:51.033 回答