chenyzvest@gmail_com
New Member
Hi all,Excuse for taking some of your time.I am trying to porting a earlier version of CESM, 1.0.4 to a new machine. The compile environment including Fortran compiler, MPI and NetCDF were prepared. The F compiler is ifort, MPI is mpiifort, NetCDF is 4.1.3. The Macros, env_machopt and mkbatch files were modified based on the set of the local machine. Then I create a newcase, configure and build following the instruction on the offical user guide. However, The ccsm build log had hundreds of undefined reference errors, some are from the "nc" and some are from "MPI", I attached some of them here, the full log file was also submitted.nc4var.c:(.text+0x29b2): undefined reference to `ncmpi_put_vara_uchar'nc4var.c:(.text+0x29d0): undefined reference to `ncmpi_put_vara_double'nc4var.c:(.text+0x29ee): undefined reference to `ncmpi_put_vara_float'nc4var.c:(.text+0x2a0c): undefined reference to `ncmpi_put_vara_int'nc4var.c:(.text+0x2a2a): undefined reference to `ncmpi_put_vara_short'nc4var.c:(.text+0x2a48): undefined reference to `ncmpi_put_vara_text'nc4var.c:(.text+0x2a66): undefined reference to `ncmpi_put_vara_schar'nc4var.c:(.text+0x2aac): undefined reference to `ncmpi_put_vara_uchar_all'nc4var.c:(.text+0x2aca): undefined reference to `ncmpi_put_vara_double_all'nc4var.c:(.text+0x2ae8): undefined reference to `ncmpi_put_vara_float_all'nc4var.c:(.text+0x2b06): undefined reference to `ncmpi_put_vara_int_all'nc4var.c:(.text+0x2b21): undefined reference to `ncmpi_put_vara_short_all'nc4var.c:(.text+0x2b3c): undefined reference to `ncmpi_put_vara_text_all' nc4var.c:(.text+0x2b57): undefined reference to `ncmpi_put_vara_schar_all'1.0.4/ciesm.model/scripts/intel-esm-soft/lib/libnetcdf.a(liboc_la-http.o): In function `ocfetchurl_file':http.c:(.text+0x52): undefined reference to `curl_easy_setopt'http.c:(.text+0x70): undefined reference to `curl_easy_setopt'http.c:(.text+0x8b): undefined reference to `curl_easy_setopt'http.c:(.text+0xa3): undefined reference to `curl_easy_setopt'http.c:(.text+0xb8): undefined reference to `curl_easy_perform'http.c:(.text+0xe1): undefined reference to `curl_easy_getinfo'http.c:(.text+0xff): undefined reference to `curl_easy_strerror'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIR_F_FALSE'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Cart_create'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIX_Comm_failure_get_acked'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Comm_free_keyval'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Comm_get_name'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Info_dup'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Irsend'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Init_thread'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Bcast'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Ssend'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Buffer_attach'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Group_range_incl'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Win_create_dynamic'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_File_iread_at'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Group_translate_ranks'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIR_F_MPI_WEIGHTS_EMPTY'
Then I don't know how to deal with this bug. I checked the solution from climatesight, who used gcc as the compiler (https://climatesight.org/2011/06/16/climate-models-on-ubuntu/):The ccsm build log had hundreds of undefined reference errors as soon as it started to compile fortran. The way I understand it, many of the fortran files reference each other, but gfortran likes to append underscores to user-defined variables, and then it can’t find the file the variable is referencing! You can suppress this using the flag-fno-underscoring.
And it does not work for my case...Does anybody could help me about this? I have been stucked for several days on the debugging. And I really need the version to be worked out recently. Thanks very much!Attached please check the related information.
Paths on the machine:Which ifort:usr/cluster/intel/composer_xe_2013_sp1.4.211/bin/intel64/ifortWhich mpiifort:usr/cluster/mpi2/bin/mpiifortWhich ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-soft/bin/ncdump My Macros. file:#===============================================================================# The following always need to be set# SPMD Whether to build in SPMD mode or not. [values TRUE FALSE]# SMP Set to TRUE to enable building in SMP mode (uses OpenMP). # USER_CPPDEFS CPP definitions (non platform dependent)##=============================================================================== # Note that CPPDEFS is set in Macros.cppdefsCPPDEFS += -DLINUX -DSEQ_$(FRAMEWORK) -DFORTRANUNDERSCORE -DNO_R16 -DNO_SHR_VMATH ifeq ($(compile_threaded), true) CPPDEFS += -DTHREADED_OMPendif ifeq ($(USE_MPISERIAL),TRUE) FC := ifort CC := iccelse FC := ifort CC := iccendif #SLIBS += -L$(LIB_NETCDF) -lnetcdff#=====================================================# GENERIC_USER# The netcdf and mpi paths need to be set somewhere. In CESM, this# is normally done by setting the NETCDF_PATH and MPICH_PATH# variables in this Macros file. But they could also be set in the # default user paths, by an explicit addition to the local path # in the env_mach_specific file, or via setting NETCDF_PATH # and MPICH_PATH environment variables in the env_mach_specific file. # Also, review the relative paths of the INC_, LIB_, and MOD_ paths# below. Ignore PNETCDF stuff initially, it's not required. ifeq ($(strip $(NETCDF_PATH)),) NETCDF_PATH := ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-softendifINC_NETCDF := $(NETCDF_PATH)/includeLIB_NETCDF := $(NETCDF_PATH)/libMOD_NETCDF := $(NETCDF_PATH)/includeifeq ($(strip $(MPICH_PATH)),) MPICH_PATH := /usr/cluster/mpi2endififeq ($(USE_MPISERIAL),TRUE) INC_MPI := $(CODEROOT)/utils/mct/mpi-serial LIB_MPI := else LIB_MPI := $(MPICH_PATH)/lib INC_MPI := $(MPICH_PATH)/includeendifMPI_LIB_NAME := mpifortPNETCDF_PATH :=INC_PNETCDF :=LIB_PNETCDF := LAPACK_LIBDIR := #===================================================== CFLAGS := $(CPPDEFS) FXEDFLAGS := -132 FREEFLAGS := -FRFFLAGS := $(CPPDEFS) -g -fp-model precise -convert big_endian -assume byterecl -ftz -tracebackFFLAGS_NOOPT := $(FFLAGS) -O0FFLAGS_OPT := -O2LDFLAGS := AR := arMOD_SUFFIX := modCONFIG_SHELL := #===============================================================================# Set include paths (needed after override for any model specific builds below)#=============================================================================== INCLDIR := -I. ifneq ($(strip $(INC_NETCDF)),)INCLDIR += -I$(INC_NETCDF)endififneq ($(strip $(MOD_NETCDF)),)INCLDIR += -I$(MOD_NETCDF)endififneq ($(strip $(INC_MPI)),)INCLDIR += -I$(INC_MPI)endif ifneq ($(strip $(INC_PNETCDF)),)INCLDIR += -I$(INC_PNETCDF)endif #===============================================================================# Set model and other specific options# NOTE - all CPPDEFS options must be defined before this point#=============================================================================== ifeq ($(DEBUG),TRUE) FFLAGS += -CU -check pointers -fpe0 -ftz FFLAGS_NOOPT += -CU -check pointers -fpe0 -ftzelse FFLAGS += $(FFLAGS_OPT)endif ifeq ($(compile_threaded), true) FFLAGS += -openmp FFLAGS_NOOPT += -openmp CFLAGS += -openmp LDFLAGS += -openmpendif ifeq ($(strip $(MODEL)),cam)# These RRTMG files cause a compiler error when using optimization.# Until mods are made to read the data from files, just remove optimization from# their compilation.rrtmg_lw_k_g.o: rrtmg_lw_k_g.f90$(FC) -c $(CPPDEFS) $(INCLDIR) $(INCS) $(FREEFLAGS) $(FFLAGS_NOOPT) $
Then I don't know how to deal with this bug. I checked the solution from climatesight, who used gcc as the compiler (https://climatesight.org/2011/06/16/climate-models-on-ubuntu/):The ccsm build log had hundreds of undefined reference errors as soon as it started to compile fortran. The way I understand it, many of the fortran files reference each other, but gfortran likes to append underscores to user-defined variables, and then it can’t find the file the variable is referencing! You can suppress this using the flag-fno-underscoring.
And it does not work for my case...Does anybody could help me about this? I have been stucked for several days on the debugging. And I really need the version to be worked out recently. Thanks very much!Attached please check the related information.
Paths on the machine:Which ifort:usr/cluster/intel/composer_xe_2013_sp1.4.211/bin/intel64/ifortWhich mpiifort:usr/cluster/mpi2/bin/mpiifortWhich ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-soft/bin/ncdump My Macros. file:#===============================================================================# The following always need to be set# SPMD Whether to build in SPMD mode or not. [values TRUE FALSE]# SMP Set to TRUE to enable building in SMP mode (uses OpenMP). # USER_CPPDEFS CPP definitions (non platform dependent)##=============================================================================== # Note that CPPDEFS is set in Macros.cppdefsCPPDEFS += -DLINUX -DSEQ_$(FRAMEWORK) -DFORTRANUNDERSCORE -DNO_R16 -DNO_SHR_VMATH ifeq ($(compile_threaded), true) CPPDEFS += -DTHREADED_OMPendif ifeq ($(USE_MPISERIAL),TRUE) FC := ifort CC := iccelse FC := ifort CC := iccendif #SLIBS += -L$(LIB_NETCDF) -lnetcdff#=====================================================# GENERIC_USER# The netcdf and mpi paths need to be set somewhere. In CESM, this# is normally done by setting the NETCDF_PATH and MPICH_PATH# variables in this Macros file. But they could also be set in the # default user paths, by an explicit addition to the local path # in the env_mach_specific file, or via setting NETCDF_PATH # and MPICH_PATH environment variables in the env_mach_specific file. # Also, review the relative paths of the INC_, LIB_, and MOD_ paths# below. Ignore PNETCDF stuff initially, it's not required. ifeq ($(strip $(NETCDF_PATH)),) NETCDF_PATH := ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-softendifINC_NETCDF := $(NETCDF_PATH)/includeLIB_NETCDF := $(NETCDF_PATH)/libMOD_NETCDF := $(NETCDF_PATH)/includeifeq ($(strip $(MPICH_PATH)),) MPICH_PATH := /usr/cluster/mpi2endififeq ($(USE_MPISERIAL),TRUE) INC_MPI := $(CODEROOT)/utils/mct/mpi-serial LIB_MPI := else LIB_MPI := $(MPICH_PATH)/lib INC_MPI := $(MPICH_PATH)/includeendifMPI_LIB_NAME := mpifortPNETCDF_PATH :=INC_PNETCDF :=LIB_PNETCDF := LAPACK_LIBDIR := #===================================================== CFLAGS := $(CPPDEFS) FXEDFLAGS := -132 FREEFLAGS := -FRFFLAGS := $(CPPDEFS) -g -fp-model precise -convert big_endian -assume byterecl -ftz -tracebackFFLAGS_NOOPT := $(FFLAGS) -O0FFLAGS_OPT := -O2LDFLAGS := AR := arMOD_SUFFIX := modCONFIG_SHELL := #===============================================================================# Set include paths (needed after override for any model specific builds below)#=============================================================================== INCLDIR := -I. ifneq ($(strip $(INC_NETCDF)),)INCLDIR += -I$(INC_NETCDF)endififneq ($(strip $(MOD_NETCDF)),)INCLDIR += -I$(MOD_NETCDF)endififneq ($(strip $(INC_MPI)),)INCLDIR += -I$(INC_MPI)endif ifneq ($(strip $(INC_PNETCDF)),)INCLDIR += -I$(INC_PNETCDF)endif #===============================================================================# Set model and other specific options# NOTE - all CPPDEFS options must be defined before this point#=============================================================================== ifeq ($(DEBUG),TRUE) FFLAGS += -CU -check pointers -fpe0 -ftz FFLAGS_NOOPT += -CU -check pointers -fpe0 -ftzelse FFLAGS += $(FFLAGS_OPT)endif ifeq ($(compile_threaded), true) FFLAGS += -openmp FFLAGS_NOOPT += -openmp CFLAGS += -openmp LDFLAGS += -openmpendif ifeq ($(strip $(MODEL)),cam)# These RRTMG files cause a compiler error when using optimization.# Until mods are made to read the data from files, just remove optimization from# their compilation.rrtmg_lw_k_g.o: rrtmg_lw_k_g.f90$(FC) -c $(CPPDEFS) $(INCLDIR) $(INCS) $(FREEFLAGS) $(FFLAGS_NOOPT) $