我正在尝试使用makefile在Linux + openmpi上编译程序,但是遇到了这个错误:我已经查看了类似问题的答案,但仍然可以修复它。
mpicc -lmpi -lm -ldl hh_visco.o hh_elastic.o abs_update.o absorb.o av_mue.o av_rho.o av_tau.o catseis.o check_fs.o checkfd.o comm_ini.o cpml_update.o exchange_par.o exchange_s_rsg.o exchange_s.o exchange_v.o sofi2D.o holbergcoeff.o info.o initproc.o json_parser.o matcopy.o matcopy_elastic.o merge.o mergemod.o note.o outseis.o outseis_glob.o operators_s.o operators_v.o PML_pro.o prepare_update_s.o psource.o rd_sour.o read_checkpoint.o read_par_json.o readdsk.o readmod_visco.o readmod_elastic.o receiver.o save_checkpoint.o saveseis.o saveseis_glob.o seismo_ssg.o snap_ssg.o sources.o splitrec.o splitsrc.o subgrid_bounds.o surface.o surface_elastic.o update_s_elastic_abs.o update_s_elastic_interior.o update_s_elastic_PML.o update_s_visc_abs.o update_s_visc_interior.o update_s_visc_PML.o update_v_abs.o update_v_interior.o update_v_PML.o util.o wavefield_update_s_el.o wavefield_update_s_visc.o wavefield_update_v.o wavelet.o write_par.o writedsk.o writemod.o zero_elastic.o zero_visc.o zero_PML_elastic.o zero_PML_visc.o -o ../bin/sofi2D
/usr/bin/ld: outseis.o: undefined reference to symbol 'trunc@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sofi2D] Error 1
makefile如下:我怀疑它与丢失的库有关,但似乎可以找到如何做到这一点。
运行编译的脚本是
#---- general compilation
cd ../src
#make all
make clean
make sofi2D
cd ../par
和下面的makefile(不是完整的)
# Makefile for SOFI2D
#--------------------------------------------------------
# edit here:
# source code for model generation
# model file for viscoelastic modeling L>0
MODEL_V = hh_visco.c
# model file for elastic modeling L=0
MODEL_E = hh_elastic.c
# model file for viscoelastic modeling (overnight built)
MODEL_BV = benchmod.c
# model file for elastic modeling L=0 (overnight built)
MODEL_BE = benchmod_el.c
EXEC= ../bin
EXEC= ../bin
# Compiler (LAM: CC=hcc, CRAY T3E: CC=cc)
# ON Linux cluster running LAM
#CC=hcc
#LFLAGS=-lm -lmpi
#CFLAGS=-Wall -O4
# ON Linux cluster running OpenMPI and ON MAC
CC=mpicc
LFLAGS=-lm -lmpi
CFLAGS=-Wall -O3
# On CRAY T3E
# CC=cc
# On SCHARnet system
#CC=mpicc
#LFLAGS=-lm
# On HLRN system
#CC=mpcc
#LFLAGS=-lm
# ALTIX
#CC=icc
#CFLAGS=-mp -O3 -ip0
#LFLAGS=-lmpi -lm
# after this line, no further editing should be necessary
# --------------------------------------------------------
.c.o:
$(CC) $(CFLAGS) -c $<