Hello all, I’ve spent the last couple days trying to compile RegCM-4.7.1 on a fresh Ubuntu 22.04 LTS install without much success. I’ve also tried the current version on GitHub with the same results, though the updated prereq_install.sh script is much appreciated. I have tried Intel Parallel Studio XE 2020, Intel oneAPI (2022.1.0) classic compilers (icc, icpc, ifort), the newer generation Intel compilers (icx, icpx, ifx), and GNU (gcc, g++, gfortran), but I still can’t get the model to fully compile.  I’ve had the most luck with newer Intel oneAPI compilers (icx, icpx, ifx), which fully built the prerequisites (zlib, OpenMPI, HDF5, NetCDF4), so it seems like the compilers are in good order. However, building and linking the RegCM model fails:

...
libtool: link: /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies//bin/mpif90 -g -o regcm mod_regcm_interface.o mod_atm_interface.o mod_che_interface.o mod_lm_interface.o mod_cu_interface.o mod_rad_interface.o mod_pbl_interface.o mod_header.o mod_advection.o mod_ncio.o mod_bdycod.o mod_diffusion.o mod_micro_interface.o mod_sun.o mod_savefile.o mod_slice.o mod_init.o mod_vmodes.o mod_split.o mod_output.o mod_tendency.o mod_params.o mod_slabocean.o mod_sldepparam.o mod_sladvection.o mod_oasis.o abort.o mod_sound.o mod_timefilter.o mod_massck.o mod_moloch.o regcm.o  -L/head4/software/models/RegCM-4.7.1_oneAPI/external -L/head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies//lib -L./clmlib -lclm -L./chemlib -lchem -Lchemlib/GAS_CBMZ_NEW -lcbmz -L./batslib -lbats -L./ocnlib -locn -L./microlib -lmicro ./cloudlib/libcloud.a -L./cumlib -lcum -L./radlib -lrad -L./pbllib -lpbl -Lradlib/RRTMG_SW -lrrtmgsw -L./mpplib -lmpp -L/head4/software/models/RegCM-4.7.1_oneAPI/Share -lrcmlib /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib/libhdf5_hl.so /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib/libhdf5.so -lz -L/head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib/libnetcdff.so /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib/libnetcdf.so -lm -L./netlib -lnetlib -Wl,-rpath -Wl,/head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib -Wl,-rpath -Wl,/head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies/lib
ld: /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies//lib/libz.so.1: no version information available (required by /lib/x86_64-linux-gnu/libbfd-2.38-system.so)
ld: /head4/software/models/RegCM-4.7.1_oneAPI/software_dependencies//lib/libz.so.1: no version information available (required by /lib/x86_64-linux-gnu/libctf.so.0)
ld: mod_moloch.o: in function `exchange_lr_.t0p.t1p.t1p.t1p.t1p.t1p.t1p.t1p':
ifxwJ5iqK.i90:(.text+0xa5cc): undefined reference to `exchange_lr_'
ld: mod_moloch.o: in function `exchange_bt_.t0p.t1p.t1p.t1p.t1p.t1p.t1p.t1p':
ifxwJ5iqK.i90:(.text+0xa5fc): undefined reference to `exchange_bt_'
ld: mod_moloch.o: in function `exchange_tb_.t2p.t1p.t1p.t1p.t1p.t1p.t1p.t1p':
ifxwJ5iqK.i90:(.text+0xa62c): undefined reference to `exchange_tb_'
ld: mod_moloch.o: in function `exchange_lr_.t2p.t1p.t1p.t1p.t1p.t1p.t1p.t1p':
ifxwJ5iqK.i90:(.text+0xa65c): undefined reference to `exchange_lr_'
make[3]: *** [Makefile:554: regcm] Error 1
make[3]: Leaving directory '/head4/software/models/RegCM-4.7.1_oneAPI/Main'
make[2]: *** [Makefile:584: all-recursive] Error 1
make[2]: Leaving directory '/head4/software/models/RegCM-4.7.1_oneAPI/Main'
make[1]: *** [Makefile:434: all-recursive] Error 1
make[1]: Leaving directory '/head4/software/models/RegCM-4.7.1_oneAPI'
make: *** [Makefile:366: all] Error 2

When I was using Intel Parallel Studio XE 2020 compilers, it failed to even compile zlib:
icc -fPIC -c -O ztest1388423.c
In file included from ztest1388423.c(1):
/usr/include/stdio.h(189): error: attribute "__malloc__" does not take arguments
    __attribute_malloc__ __attr_dealloc_fclose __wur;

In both cases, the compile or linker is calling OS system paths (/usr/include/ or /lib/x86_64-linux-gnu/). I am starting to suspect Ubuntu 22.04 is just too new for these compilers and is out of sync with the OS system GNU tools, specially GCC. The OS default uses gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0. Ubuntu 22.04 LTS is newer than the current Intel oneAPI and not currently a supported OS version (and it is obviously newer than Intel Parallel Studio XE 2020). I could potentially install and configure the OS to use an older version of GCC through the package manager. 

I was wondering if anyone has had success running RegCM-4.7.1 or newer on Ubuntu 22.04 LTS? It might be easier and lot quicker to install Ubuntu 20.04 on our machines rather than trying to force these compilers to work on 22.04. If Ubuntu 20.04 is the way to go, what version of Intel compilers would work?

Thanks for any advice.


Jay Alder
Geology, Minerals, Energy, and Geophysics Science Center
U.S. Geological Survey
https://www.usgs.gov/staff-profiles/jay-alder
Oregon State University
104 CEOAS Admin Building
Corvallis, OR 97331