I use a model is written Fortran90 under Ubuntu 14.04. The gfortran 95 compiler (gfortran 4:4.8.2-1ubuntu6) and the gcc 4:4.8.2-1ubuntu6 is installed by Ubuntu Software Center. The installed gcc has an 4.9 empty folder in usr/lib/gcc/x86_64-linux/gnu as well. The required netCDF libraries (netCDF C and Fortran netCDF) are installed as suggested in: http://www.unidata.ucar.edu/software/netcdf/docs/. The netcdf is built as shared library.
The compiler options and LDFLAGS is set in the compiler_options.inc file by the following way:
ifeq ($(COMPILER), gfortran)
FPP= -x f95-cpp-input
ifdef TESTING
OPTS=-g -O0 -W -Wall -pedantic-errors -fbounds-check -fbacktrace \
-ffpe-trap=invalid,zero,overflow -frange-check #-Werror
else
OPTS=-O3 -pg -g
endif
endif
INCDF=-I$(NCPATH)/include
LNCDF=-L$(NCPATH)/lib -lnetcdff -lnetcdf
LDFLAGS=$(INCDF) $(LNCDF)
When I compile the model I get the following messages:
/home/Beata/kid_a_setup/src/test_cases_2d.f90:1446: undefined reference to `_gfortran_runtime_error_at'
/home/Beata/kid_a_setup/src/test_cases_2d.f90:1446: undefined reference to `_gfortran_runtime_error_at'
/home/Beata/kid_a_setup/src/test_cases_2d.f90:1446: undefined reference to `_gfortran_runtime_error_at'
/home/Beata/kid_a_setup/src/test_cases_2d.f90:1449: undefined reference to `_gfortran_runtime_error_at'
../obj/test_cases_2d.o:/home/Beata/kid_a_setup/src/test_cases_2d.f90:1449: more undefined references to `_gfortran_runtime_error_at' follow
../obj/test_cases_2d.o: In function `__test_cases_2d_MOD_set_gate_thermo_profile':
It seems that gcc may not have found fortran libraries.
Could someone explain me what causes the error and how I can fix it?
-lgfortran
).-lgfortran
to theLDFLAGS
. You should consider including the relevant portion of the makefile as well, i.e. the rule(s) for your executable target(s).-lgfortran
i.e.LDFLAGS=$(INCDF) $(LNCDF) -lgfortran