Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Undefined references when linking CLM3.5 object files

Hi,

I succeed in compiling the CLM3.5 source code with the fortran compiler gfortran. However, the linking does not work and produces the following output in MAKE.out:

...
gfortran -o /home/klaueckh/clm3.5/Hohenheim/bld/clm BalanceCheckMod.o ...[I skip some text here]... wrf_message.o -L/usr/local/lib -lnetcdf
controlMod.o: In function `__controlmod__control_spmd':
controlMod.F90:(.text+0x954): undefined reference to __histfilemod__hist_fexcl1'
controlMod.F90:(.text+0x97f): undefined reference to `__histfilemod__hist_fexcl2'
controlMod.F90:(.text+0x9aa): undefined reference to `__histfilemod__hist_fexcl3'
controlMod.F90:(.text+0x9d5): undefined reference to `__histfilemod__hist_fexcl4'
controlMod.F90:(.text+0xa00): undefined reference to `__histfilemod__hist_fexcl5'
controlMod.F90:(.text+0xa2b): undefined reference to `__histfilemod__hist_fexcl6'
controlMod.F90:(.text+0xa54): undefined reference to `__histfilemod__hist_fincl1'
controlMod.F90:(.text+0xa81): undefined reference to `__histfilemod__hist_fincl2'
controlMod.F90:(.text+0xaaa): undefined reference to `__histfilemod__hist_fincl3'
controlMod.F90:(.text+0xad5): undefined reference to `__histfilemod__hist_fincl4'
controlMod.F90:(.text+0xb00): undefined reference to `__histfilemod__hist_fincl5'
controlMod.F90:(.text+0xb2b): undefined reference to `__histfilemod__hist_fincl6'
controlMod.o: In function `__controlmod__control_init':
controlMod.F90:(.text+0x17e0): undefined reference to `__histfilemod__hist_fincl1'
controlMod.F90:(.text+0x181d): undefined reference to `__histfilemod__hist_fincl2'
controlMod.F90:(.text+0x185a): undefined reference to `__histfilemod__hist_fincl3'
controlMod.F90:(.text+0x1897): undefined reference to `__histfilemod__hist_fincl4'
controlMod.F90:(.text+0x18d4): undefined reference to `__histfilemod__hist_fincl5'
controlMod.F90:(.text+0x1911): undefined reference to `__histfilemod__hist_fincl6'
controlMod.F90:(.text+0x194e): undefined reference to `__histfilemod__hist_fexcl1'
controlMod.F90:(.text+0x198b): undefined reference to `__histfilemod__hist_fexcl2'
controlMod.F90:(.text+0x19c8): undefined reference to `__histfilemod__hist_fexcl3'
controlMod.F90:(.text+0x1a05): undefined reference to `__histfilemod__hist_fexcl4'
controlMod.F90:(.text+0x1a42): undefined reference to `__histfilemod__hist_fexcl5'
controlMod.F90:(.text+0x1a7f): undefined reference to `__histfilemod__hist_fexcl6'
m_FileResolv.o: In function `__m_fileresolv__fileresolv':
m_FileResolv.F90:(.text+0xb5f): undefined reference to `system_'
m_FileResolv.F90:(.text+0xee1): undefined reference to `system_'
shr_sys_mod.o: In function `__shr_sys_mod__shr_sys_system':
shr_sys_mod.F90:(.text+0x9): undefined reference to `system_'
shr_sys_mod.o: In function `__shr_sys_mod__shr_sys_chdir':
shr_sys_mod.F90:(.text+0x4b): undefined reference to `chdir_'
collect2: ld returned 1 exit status

I should perhaps add that I have defined

FFLAGS=-ff2c -fno-second-underscore
FCFLAGS=-ff2c -fno-second-underscore

before compiling NETCDF, and that I have set

FFLAGS := $(cpp_path) $(mod_path) $(CPPDEF) -extend_source -ff2c -fno-second-underscore

in clm3.5/bld/Makefile.in. It is not clear to me why I nevertheless see names with two underscores here. But perhaps this is not the problem at all. What else could it be?

Thank you very much for your help!

KlausE
 
Hi,

by and large, I could solve the problem. The error messages

controlMod.o: In function `__controlmod__control_spmd':
controlMod.F90:(.text+0x954): undefined reference to __histfilemod__hist_fexcl1'
...
controlMod.F90:(.text+0x1a7f): undefined reference to `__histfilemod__hist_fexcl6'

seem to be caused by the "equivalence" statement in src/main/histFileMod.F90.

The messages

m_FileResolv.o: In function `__m_fileresolv__fileresolv':
m_FileResolv.F90:(.text+0xb5f): undefined reference to `system_'
m_FileResolv.F90:(.text+0xee1): undefined reference to `system_'
shr_sys_mod.o: In function `__shr_sys_mod__shr_sys_system':
shr_sys_mod.F90:(.text+0x9): undefined reference to `system_'
shr_sys_mod.o: In function `__shr_sys_mod__shr_sys_chdir':
shr_sys_mod.F90:(.text+0x4b): undefined reference to `chdir_'
collect2: ld returned 1 exit status

disappeared when I commented out the declaration of "system" and "chdir" in
src/utils/mct/mpeu/m_FileResolv.F90 and src/csm_share/shr/shr_sys_mod.F90.

KlausE
 
Top