[RegCNET] Trouble compiling RegCM-4.7.1 on Ubuntu 22.04 LTS
Alder, Jay
jay.alder at oregonstate.edu
Wed Aug 10 01:48:53 CEST 2022
I wanted to follow up on compiling RegCM-4.7.1 on Ubuntu. I’ve found the version of GCC installed on the system is critical and RegCM seems to only compile and link with GCC version 8 or lower using the Intel compilers. The latest Ubuntu 22.04 defaults to GCC 11, but you can also install 9 or 10. Ubuntu 20.04 defaults to GCC 9, but you can install 7-10 from the package manager.
I managed to get RegCM-4.7.1 to compile on Ubuntu 20.04 Server and the Intel oneAPI HPC classic compilers (icc, icpc, ifort), but you have to be really careful on how you install GCC (and make sure GCC-9 or higher doesn’t get installed by mistake).
Here are the packages I installed on a fresh Ubuntu 20.04 LTS Server:
apt -y install gcc-8 g++-8 gfortran-8 libtool make automake autoconf
You then need to tell the OS to use these older GNU compilers
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 8
The next part is getting the Intel oneAPI installed. If you install oneAPI via the APT package manager, the package manager will also install the OS default GCC (which is 9 on Ubuntu 20.04). You can avoid oneAPI installing GCC-9 by using the Online or Offline shell script installers. Another warning, the full Ubuntu 20.04 LTS Desktop distribution will automatically install GCC-9 from the beginning, so I used the Server install where you can have a minimal install and choose the correct GCC (again 8 or lower). This combination worked for me: Ubuntu 20.04 Server + GCC-8, Intel oneAPI (2022.1.0) and RegCM-4.7.1.
There may be a way on Ubuntu 22.04 or higher to add an archived Ubuntu release (ie focal [20.04LTS]) to your package manager sources list, but I didn’t explore this.
Good luck all!
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
On Aug 4, 2022, at 2:19 PM, Alder, Jay <jay.alder at oregonstate.edu<mailto:jay.alder at oregonstate.edu>> wrote:
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<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.usgs.gov%2Fstaff-profiles%2Fjay-alder&data=05%7C01%7CJay.Alder%40oregonstate.edu%7C82baef473dbb4e92c1d808da76b3a320%7Cce6d05e13c5e4d6287a84c4a2713c113%7C0%7C0%7C637952811163209542%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5n5v49jVaVHZtzcgR1VvbOnnBRGfdj7sDwz%2BFwEsYaM%3D&reserved=0>
Oregon State University
104 CEOAS Admin Building
Corvallis, OR 97331
_______________________________________________
RegCNET mailing list
RegCNET at lists.ictp.it<mailto:RegCNET at lists.ictp.it>
https://lists.ictp.it/mailman/listinfo/regcnet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ictp.it/pipermail/regcnet/attachments/20220809/e9674da8/attachment-0001.htm>
More information about the RegCNET
mailing list