Undefined references in libwrflib.a [solved]

All things involving the setup (compiling, NetCDF, etc.) of the WRF Model itself.

Undefined references in libwrflib.a [solved]

Postby manuavazquez » Fri Nov 09, 2018 4:18 am


when I try to compile WRF 3.9.1 I get, after a while, a lot of undefined references. The problems start with

Code: Select all
time gfortran -o wrf.exe  -O2 -ftree-vectorize -funroll-loops -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4    wrf.o ../main/module_wrf_top.o libwrflib.a /home/manu/meteo/4/WRF-4.0.1/external/fftpack/fftpack5/libfftpack.a /home/manu/meteo/4/WRF-4.0.1/external/io_grib1/libio_grib1.a /home/manu/meteo/4/WRF-4.0.1/external/io_grib_share/libio_grib_share.a /home/manu/meteo/4/WRF-4.0.1/external/io_int/libwrfio_int.a -L/home/manu/meteo/4/WRF-4.0.1/external/esmf_time_f90 -lesmf_time /home/manu/meteo/4/WRF-4.0.1/frame/module_internal_header_util.o /home/manu/meteo/4/WRF-4.0.1/frame/pack_utils.o  -L/home/manu/meteo/4/WRF-4.0.1/external/io_netcdf -lwrfio_nf -L/usr/lib -lnetcdff -lnetcdf             
../main/module_wrf_top.o: En la función `__module_wrf_top_MOD_alloc_doms_for_dfi':
module_wrf_top.f90:(.text+0x10c): referencia a `setup_timekeeping_' sin definir
module_wrf_top.f90:(.text+0x13d): referencia a `med_nest_initial_' sin definir
../main/module_wrf_top.o: En la función `__module_wrf_top_MOD_wrf_finalize':
module_wrf_top.f90:(.text+0x525): referencia a `med_shutdown_io_' sin definir
../main/module_wrf_top.o: En la función `__module_wrf_top_MOD_wrf_dfi':
module_wrf_top.f90:(.text+0x8d6): referencia a `wrf_dfi_bck_init_' sin definir
module_wrf_top.f90:(.text+0x9a0): referencia a `wrf_dfi_fwd_init_' sin definir

...and many more afterwards

References are indeed missing (at least, from libwrflib.a)

Code: Select all
manu@totolaca main $nm -s libwrflib.a  | grep -i setup_timekeeping_
                 U setup_timekeeping_

Funny thing, WRF used to compile fine for me some months ago (I had to put my WRF-relying project on hold for almost a year), so I'm guessing it's a problem related to library or gcc (7.3.0) versions. I'm on Gentoo.

Any clue?


PS: I also tried version 4.0.1 and I get the same errors.
Last edited by manuavazquez on Sat Nov 10, 2018 7:16 am, edited 1 time in total.
Posts: 7
Joined: Thu Sep 21, 2017 7:18 am

Re: Undefined references in libwrflib.a

Postby kwthomas » Fri Nov 09, 2018 4:26 pm


FIrst of all, don't use WRF 3.9.1. Use WRF There is a subscript problem in part of 3.9.1.

Look in your log file for earlier errors. In particular, look for "libwrflib.a".

I've seen a report recently where the log complained about "ar" (archive command take creates
"libwrflib.a"). I think it was also a GFORTRAN user.
Kevin W. Thomas
Center for Analysis and Prediction of Storms
University of Oklahoma
Posts: 246
Joined: Thu Aug 07, 2008 6:53 pm

Re: Undefined references in libwrflib.a

Postby manuavazquez » Sat Nov 10, 2018 5:56 am

Hi Kevin,

thanks for your prompt reply.

I switched to WRF- and am still getting the same error.

About "libwrflib.a", first time it is mentioned in the log is

Code: Select all
/bin/rm -f main/libwrflib.a main/libwrflib.lib

which, I guess, bears 0 information, and then

Code: Select all
make[2]: se entra en el directorio '/home/manu/wrfck/manual/WRF-'
ar ru ../main/libwrflib.a module_driver_constants.o module_domain_type.o module_streams.o module_domain.o module_integrate.o module_timing.o module_configure.o module_tiles.o module_machine.o module_nesting.o module_wrf_error.o module_state_description.o module_sm.o module_io.o module_comm_dm.o module_comm_dm_0.o module_comm_dm_1.o module_comm_dm_2.o module_comm_dm_3.o module_comm_dm_4.o module_comm_nesting_dm.o module_dm.o module_quilt_outbuf_ops.o module_io_quilt.o module_intermediate_nmm.o module_cpl.o module_cpl_oasis3.o module_clear_halos.o wrf_num_bytes_between.o wrf_shutdown.o wrf_debug.o libmassv.o collect_on_comm.o hires_timer.o clog.o nl_get_0_routines.o nl_get_1_routines.o nl_get_2_routines.o nl_get_3_routines.o nl_get_4_routines.o nl_get_5_routines.o nl_get_6_routines.o nl_get_7_routines.o nl_set_0_routines.o nl_set_1_routines.o nl_set_2_routines.o nl_set_3_routines.o nl_set_4_routines.o nl_set_5_routines.o nl_set_6_routines.o nl_set_7_routines.o  module_alloc_space_0.o module_alloc_space_1.o module_alloc_space_2.o module_alloc_space_3.o module_alloc_space_4.o module_alloc_space_5.o module_alloc_space_6.o module_alloc_space_7.o module_alloc_space_8.o module_alloc_space_9.o
ar: creando ../main/libwrflib.a
ranlib ../main/libwrflib.a

which seems fine to me (sorry that everything is in Spanish).

However, I perused again through the file and found one earlier fatal error

Code: Select all
landread.c:68:10: error fatal: rpc/types.h: No existe el fichero o el directorio

(file or directory not found)

Doing some research, it seems that "rpc/types.h" was deprecated from glibc some time ago and moved into libtirpc. So, in my machine I have no /usr/include/rpc/types.h but I do have
/usr/include/tirpc/rpc/types.h. Then, I tried to let WRF know about this by tweaking configure.wrf (after running configure) by adding

Code: Select all
-I/usr/include/tirpc \

as the last line in variable INCLUDE_MODULES, and added the same thing to CPPFLAGS. However, I get the exact same error...and that's how far I got. So, now the problem is how to tell WRF to look in the right place for types.h.

Any clue?

Posts: 7
Joined: Thu Sep 21, 2017 7:18 am

Re: Undefined references in libwrflib.a

Postby manuavazquez » Sat Nov 10, 2018 7:16 am

Ok, I kept trying and this is solved :D

When compiling, I need to point environment variable CPATH to the location of tirpc

Code: Select all
CPATH="/usr/include/tirpc" ./compile em_real

but before, after running configure, I also need to edit configure.wps and add -ltirpc at the end of LIB_EXTERNAL.


and thanks for your input!!
Posts: 7
Joined: Thu Sep 21, 2017 7:18 am

Return to Installation

Who is online

Users browsing this forum: Google [Bot] and 7 guests