0

I am trying to compile a program on Linux+openmpi using a makefile but got this error: I have looked at answers to similar issues but can still fix it.

 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

The makefile is below: I suspect it has to do with a missing library, but can seems to find how to do that.

the script to run the compilation is

#---- general compilation

cd ../src
#make all
make clean
make sofi2D
cd ../par

and makefile below (not entire)

# 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 $<
Cœur
  • 37,241
  • 25
  • 195
  • 267
Johnson T
  • 27
  • 5

0 Answers0