我正在尝试安装一个专为天气建模而设计的软件包。这可以在这里找到https://github.com/usgs/volcano-ash3d-metreader。当我尝试执行“全部制作”命令时,问题就出现了。运行时,我得到以下输出:
/usr/bin/gfortran -O0 -g3 -Wall -fbounds-check -pedantic -fimplicit-none -Wunderflow -Wuninitialized -ffpe-trap=invalid,zero,overflow -fdefault-real-8 -L./ -lMetReader -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/opt/USGS/lib -I/usr/lib -I/usr/local/include -I/usr/include -I/usr/lib/x86_64-linux-gnu -I/opt/USGS/include -I/usr/local/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -leccodes -leccodes_f90 -c tools/MetSonde.f90
/usr/bin/gfortran -O0 -g3 -Wall -fbounds-check -pedantic -fimplicit-none -Wunderflow -Wuninitialized -ffpe-trap=invalid,zero,overflow -fdefault-real-8 MetSonde.o -L./ -lMetReader -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/opt/USGS/lib -I/usr/lib -I/usr/local/include -I/usr/include -I/usr/lib/x86_64-linux-gnu -I/opt/USGS/include -I/usr/local/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -leccodes -leccodes_f90 -L/opt/USGS/lib -I/opt/USGS/include -lhourssince -lprojection -o tools/MetSonde
/usr/bin/gfortran -x f95-cpp-input -DFORWARD -O0 -g3 -Wall -fbounds-check -pedantic -fimplicit-none -Wunderflow -Wuninitialized -ffpe-trap=invalid,zero,overflow -fdefault-real-8 tools/MetTraj.F90 -o tools/MetTraj_F -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/opt/USGS/lib -I/usr/lib -I/usr/local/include -I/usr/include -I/usr/lib/x86_64-linux-gnu -I/opt/USGS/include -I/usr/local/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -leccodes -leccodes_f90 -L./ -lMetReader -L/opt/USGS/lib -I/opt/USGS/include -lhourssince -lprojection
.//libMetReader.a(MetReader_NetCDF.o): In function `mr_set_met_dims_template_netcdf_':
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2249: undefined reference to `__netcdf_MOD_nf90_open'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2251: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2279: undefined reference to `__netcdf_MOD_nf90_inq_dimid'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2281: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2282: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2285: undefined reference to `__netcdf_MOD_nf90_inquire_dimension'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2287: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2288: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2298: undefined reference to `__netcdf_MOD_nf90_inq_varid'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2300: undefined
.
.
.
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2871: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2872: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2885: undefined reference to `__netcdf_MOD_nf90_get_var_4d_fourbytereal'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2887: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2888: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2902: undefined reference to `__netcdf_MOD_nf90_get_var_3d_fourbytereal'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2904: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:2905: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:3061: undefined reference to `__netcdf_MOD_nf90_close'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:3063: undefined reference to `__netcdf_MOD_nf90_strerror'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_NetCDF.f90:3064: undefined reference to `__netcdf_MOD_nf90_strerror'
.//libMetReader.a(MetReader_GRIB.o): In function `mr_read_met_dimvars_grib_':
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:104: undefined reference to `__grib_api_MOD_grib_open_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:105: undefined reference to `__grib_api_MOD_grib_new_from_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:107: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:108: undefined reference to `__grib_api_MOD_grib_release'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:109: undefined reference to `__grib_api_MOD_grib_close_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:123: undefined reference to `__grib_api_MOD_grib_open_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:125: undefined reference to `__grib_api_MOD_grib_new_from_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:134: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:135: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:141: undefined reference to `__grib_api_MOD_grib_get_string'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:142: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:144: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:149: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:186: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:190: undefined reference to `__grib_api_MOD_grib_get_data_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:202: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:208: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:214: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:216: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:225: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:229: undefined reference to `__grib_api_MOD_grib_get_data_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:241: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:247: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:259: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:279: undefined reference to `__grib_api_MOD_grib_get_real8'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:281: undefined reference to `__grib_api_MOD_grib_get_real8'
.//libMetReader.a(MetReader_GRIB.o):/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:283: more undefined references to `__grib_api_MOD_grib_get_real8' follow
.//libMetReader.a(MetReader_GRIB.o): In function `mr_read_met_dimvars_grib_':
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:306: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:308: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:311: undefined reference to `__grib_api_MOD_grib_get_int'
.
.
.
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1378: undefined reference to `__grib_api_MOD_grib_index_release'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1385: undefined reference to `__grib_api_MOD_grib_open_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1388: undefined reference to `__grib_api_MOD_grib_multi_support_on'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1391: undefined reference to `__grib_api_MOD_grib_new_from_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1395: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1396: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1397: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1398: undefined reference to `__grib_api_MOD_grib_get_int'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1399: undefined reference to `__grib_api_MOD_grib_get_int'
.//libMetReader.a(MetReader_GRIB.o):/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1400: more undefined references to `__grib_api_MOD_grib_get_int' follow
.//libMetReader.a(MetReader_GRIB.o): In function `mr_read_metp_variable_grib_':
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1423: undefined reference to `__grib_api_MOD_grib_get_real8_array'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1443: undefined reference to `__grib_api_MOD_grib_release'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1444: undefined reference to `__grib_api_MOD_grib_new_from_file'
/home/trevor/Downloads/volcano-ash3d-metreader-master/MetReader_GRIB.f90:1446: undefined reference to `__grib_api_MOD_grib_close_file'
collect2: error: ld returned 1 exit status
makefile:174: recipe for target 'MetTraj_F' failed
make: *** [MetTraj_F] Error 1
我相信我的 makefile 根本没有引用 grib_api_mod 和 NetCDF_Mod 的正确位置,但我似乎无法找到纠正此问题的最佳方法。在这里,我还附上了我正在执行的 make 文件。
##############################################################################
# Makefile for libmetreader.a
#
# User-specified flags are in this top block
#
###############################################################################
# This file is a component of the volcanic ash transport and dispersion model Ash3d,
# written at the U.S. Geological Survey by Hans F. Schwaiger ([email protected]),
# Larry G. Mastin ([email protected]), and Roger P. Denlinger ([email protected]).
# The model and its source code are products of the U.S. Federal Government and therefore
# bear no copyright. They may be copied, redistributed and freely incorporated
# into derivative products. However as a matter of scientific courtesy we ask that
# you credit the authors and cite published documentation of this model (below) when
# publishing or distributing derivative products.
# Schwaiger, H.F., Denlinger, R.P., and Mastin, L.G., 2012, Ash3d, a finite-
# volume, conservative numerical model for ash transport and tephra deposition,
# Journal of Geophysical Research, 117, B04204, doi:10.1029/2011JB008968.
# We make no guarantees, expressed or implied, as to the usefulness of the software
# and its documentation for any purpose. We assume no responsibility to provide
# technical support to users of this software.
# SYSTEM specifies which compiler to use
# Current available options are:
# gfortran , ifort
# This variable cannot be left blank
#
SYSTEM = gfortran
#
# RUN specifies which collection of compilation flags that should be run
# Current available options are:
# DEBUG : includes debugging info and issues warnings
# PROF : includes profiling flags with some optimization
# OPT : includes optimizations flags for fastest runtime
# This variable cannot be left blank
RUN =DEBUG
#
INSTALLDIR=/opt/USGS
#INSTALLDIR=~/gcc
#
# DATA FORMATS
# For each data format you want to include in the library, set the corresponding
# variable below to 'T'. Set to 'F' any you do not want compiled or any unavailable
USENETCDF = T
USEGRIB = T
# MEMORY
# If you need pointer arrays instead of allocatable arrays, set this to 'T'
USEPOINTERS = F
###############################################################################
##### END OF USER SPECIFIED FLAGS ###########################################
###############################################################################
FPPFLAGS =
ifeq ($(USENETCDF), T)
ncFPPFLAG = -DUSENETCDF
ncOBJS = MetReader_NetCDF.o
nclib = -lnetcdff -lnetcdf
else
ncFPPFLAG =
ncOBJS =
nclib =
endif
ifeq ($(USEGRIB), T)
grbFPPFLAG = -DUSEGRIB
grbOBJS = MetReader_GRIB.o MetReader_GRIB_index.o
# These are the libraries for grib_api
#grblib = -lgrib_api_f90 -lgrib_api
# These are the libraries for ecCodes
grblib = -leccodes -leccodes_f90
else
grb2FPPFLAG =
grb2OBJS =
grblib =
endif
ifeq ($(USEPOINTERS), T)
memFPPFLAG = -DUSEPOINTERS
else
memFPPFLAG =
endif
FPPFLAGS = -x f95-cpp-input $(ncFPPFLAG) $(grbFPPFLAG) $(grbFPPFLAG) $(memFPPFLAG)
# location of HoursSince and projection
USGSLIBDIR = -L$(INSTALLDIR)/lib
USGSINC = -I$(INSTALLDIR)/include
USGSLIB = $(USGSLIBDIR) $(USGSINC) -lhourssince -lprojection
EXEC = \
gen_GRIB_index \
tools/MetSonde \
tools/MetTraj_F \
tools/MetTraj_B \
tools/MetCheck \
tools/makegfsncml
###############################################################################
###############################################################################
###############################################################################
########## GNU Fortran Compiler #############################################
ifeq ($(SYSTEM), gfortran)
FCHOME=/usr
FC = /usr/bin/gfortran
COMPINC = -I$(FCHOME)/local/include -I$(FCHOME)/include -I$(FCHOME)/lib/x86_64-linux-gnu -I$(INSTALLDIR)/include -I$(FCHOME)/local/lib
COMPLIBS = -L$(FCHOME)/local/lib -L$(FCHOME)/lib/x86_64-linux-gnu -L${INSTALLDIR}/lib -I$(FCHOME)/lib
#COMPINC = -I$(FCHOME)/include -I$(INSTALLDIR)/include
#COMPLIBS = -L$(FCHOME)/lib64 -L${INSTALLDIR}/lib
LIBS = $(COMPLIBS) $(COMPINC) #-lefence
# -lefence
# Debugging flags
ifeq ($(RUN), DEBUG)
FFLAGS = -O0 -g3 -Wall -fbounds-check -pedantic -fimplicit-none -Wunderflow -Wuninitialized -ffpe-trap=invalid,zero,overflow -fdefault-real-8
endif
# Profiling flags
ifeq ($(RUN), PROF)
FFLAGS = -g -pg -w -fno-math-errno -funsafe-math-optimizations -fno-trapping-math -fno-signaling-nans -fcx-limited-range -fno-rounding-math -fdefault-real-8
endif
# Production run flags
ifeq ($(RUN), OPT)
FFLAGS = -O3 -w -fno-math-errno -funsafe-math-optimizations -fno-trapping-math -fno-signaling-nans -fcx-limited-range -fno-rounding-math -fdefault-real-8
endif
EXFLAGS =
endif
###############################################################################
all: libMetReader.a tools
libMetReader.a: MetReader.F90 MetReader.o $(ncOBJS) $(grbOBJS) MetReader_Grids.o MetReader_ASCII.o makefile
ar rcs libMetReader.a MetReader.o $(ncOBJS) $(grbOBJS) MetReader_Grids.o MetReader_ASCII.o
MetReader.o: MetReader.F90 makefile
$(FC) $(FPPFLAGS) $(EXFLAGS) -c MetReader.F90
MetReader_Grids.o: MetReader_Grids.f90 MetReader.o makefile
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) -c MetReader_Grids.f90
MetReader_ASCII.o: MetReader_ASCII.f90 MetReader.o makefile
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) -c MetReader_ASCII.f90
ifeq ($(USENETCDF), T)
MetReader_NetCDF.o: MetReader_NetCDF.f90 MetReader.o makefile
$(FC) $(FPPFLAGS) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) $(USGSLIB) -c MetReader_NetCDF.f90
endif
ifeq ($(USEGRIB), T)
MetReader_GRIB_index.o: MetReader_GRIB_index.f90 makefile
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) $(USGSLIB) -c MetReader_GRIB_index.f90
MetReader_GRIB.o: MetReader_GRIB.f90 MetReader_GRIB_index.o MetReader.o makefile
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) -c MetReader_GRIB.f90
gen_GRIB_index: gen_GRIB_index.f90 MetReader_GRIB_index.o makefile libMetReader.a
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) -c gen_GRIB_index.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetReader_GRIB_index.o gen_GRIB_index.o $(LIBS) $(grblib) -o gen_GRIB_index
endif
ifeq ($(USEGRIB), T)
GRIBTOOL = gen_GRIB_index
else
GRIBTOOL =
endif
tools: MetSonde MetTraj_F MetTraj_B MetCheck makegfsncml $(GRIBTOOL)
MetSonde: tools/MetSonde.f90 makefile libMetReader.a
$(FC) $(FFLAGS) $(EXFLAGS) -L./ -lMetReader $(LIBS) $(nclib) $(grblib) -c tools/MetSonde.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetSonde.o -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB) -o tools/MetSonde
MetTraj_F: tools/MetTraj.F90 makefile libMetReader.a
$(FC) -x f95-cpp-input -DFORWARD $(FFLAGS) $(EXFLAGS) tools/MetTraj.F90 -o tools/MetTraj_F $(LIBS) $(nclib) $(grblib) -L./ -lMetReader $(USGSLIB)
MetTraj_B: tools/MetTraj.F90 makefile libMetReader.a
$(FC) -x f95-cpp-input -DBACKWARD $(FFLAGS) $(EXFLAGS) tools/MetTraj.F90 -o tools/MetTraj_B $(LIBS) $(nclib) $(grblib) -L./ -lMetReader $(USGSLIB)
MetCheck: tools/MetCheck.f90 makefile libMetReader.a
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) $(grblib) -c tools/MetCheck.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetCheck.o $(LIBS) $(nclib) $(grblib) -L./ -lMetReader $(USGSLIB) -o tools/MetCheck
makegfsncml: tools/makegfsncml.f90 makefile
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) -c tools/makegfsncml.f90
$(FC) $(FFLAGS) $(EXFLAGS) makegfsncml.o $(LIBS) $(nclib) -o tools/makegfsncml
clean:
rm -f *.o
rm -f *.mod
rm -f lib*.a
rm -f $(EXEC)
install:
install -d $(INSTALLDIR)/lib/
install -d $(INSTALLDIR)/include/
install -d $(INSTALLDIR)/bin/
install -d $(INSTALLDIR)/bin/autorun_scripts
install -m 644 libMetReader.a $(INSTALLDIR)/lib/
install -m 644 *.mod $(INSTALLDIR)/include/
install -m 755 $(EXEC) $(INSTALLDIR)/bin/
install -m 755 autorun_scripts/*.sh $(INSTALLDIR)/bin/autorun_scripts/
对此的任何帮助或建议将不胜感激。谢谢!