I am trying to compile a program in Wavewatch III with a modified version of the switch NCEP_glwu
, in which grib files are used. In the modified version of NCEP_glwu
I simply deleted the switches NOPA
and LRB4, since they have been deprecated. In any case, I have tried with other switches (e.g., Ifremer1) and I always find the same problem.
Using the modified NCEP_glwu switch
, in which NOPA
and LRB4
have been removed, I always get an error message during the compilation procedure when ad3
, after processing ww3_grib
, tries to link this file (ww3_grib
). This is the error:
Processing ww3_grib
---------------------
ad3 : processing ww3_grib
Linking ww3_grib
make: *** [makefile:400: /home/tesalia/WW3/model/exe/ww3_grib] Error 1
I checked the makefile located at WW3/model/src
. Line 400 in makefile
states:
@$(aPb)/link ww3_grib w3parall wmmdatmd w3triamd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd w3sdb1md w3sbt1md w3src4md w3flx1md w3snl3md w3iogrmd w3iogomd constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd
I also checked the ad3 file, located at WW3/model/bin
and I saw that Error 1
refers to Input errors
. Therefore, I checked the ww3_grib
file that should be located at WW3/model/exe
and it does not exist. In other words, it is not created by my model. I think this may be the source of the problem, but I do not know how to handle it. Below I describe my configuration.
Error files (especially ww3_grib.err
) and logs located at WW3/model/tmp
are empty. The only file with some content is located at WW3/model/obj_SEQ/link.err
, and states:
gfortran: error: big_endian: File or directory not found
gfortran: error: byterecl: File or directory not found
gfortran: error: unrecognized command line option ‘-convert’; did you mean ‘-fconvert=’?
gfortran: error: unrecognized command line option ‘-assume’
gfortran: error: unrecognized command line option ‘-prec-div’
gfortran: error: unrecognized command line option ‘-prec-sqrt’
gfortran: error: unrecognized command line option ‘-ip’; did you mean ‘-p’?
I do not know how to handle this information. Reading on the Internet, I found a solution that suggest changing line 111 in link.tmpl (WW3/model/bin/link.tmpl) from:
opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip"
To:
opt="$opt -fconvert=big-endian -assume byterecl -prec-div -prec-sqrt -ip"
As a result, the first line of the aforementioned error disappeared (i.e., "gfortran error: big_endian (...)). I tried to change the remaining parts of line 111 (i.e., -assume byterecl
, -prec-div
, -prec-sqrt
, -ip
), but I do not find the proper synthax to do so.
To Reproduce
Since I have other programs using some libraries required for WW3 (e.g., I have install a WRF model that also uses jasper, zlib and png), I am not using a hpc-stack nor something similar. I have installed almost all libraries by hand. Next, I detail the libraries that were installed in my system before installing WW3:
NetCDF
nf-config --version -> Output: netCDF-Fortran 4.5.2 nf-config --has-nc4-> Output: yes
Jasper -> Jasper 1.900.1
HDF5 -> HDF5 1.10.4
zlib -> 1.2.11
libpng -> 1.6.37
libjpeg -> 8.2.2
I installed these other libraries (code is described too):
CMake (Please, see https://github.com/Kitware/CMake/tree/21e60da5bb0715e09f2feba5930ea2c8bc8180af) -> Version 3.22.2021
git clone https://github.com/Kitware/CMake.git
cd CMake
./bootstrap --prefix=/home/tesalia/cmake -- -DCMAKE_USE_OPENSSL=OFF
./bootstrap && make && sudo make install
NCEPLIBS (it includes several libraries. Please, see https://github.com/NOAA-EMC/NCEPLIBS)
git clone https://github.com/NOAA-EMC/NCEPLIBS
mkdir -p build && cd build
cmake –DCMAKE_INSTALL_PREFIX=/usr/lib/x86_64-linux-gnu/nceplibs /home/tesalia/NCEPLIBS
sudo make
WAVEWATCH 3 (I am using my own fork, but the library is exactly the same, saving from some modified switches as indicated above)
sudo git clone https://github.com/Josue9740/WW3
cd WW3
sudo sh model/bin/ww3_from_ftp.sh
I declared these environment variables in ~/.bash_profile
export PNG_LIB=/usr/lib/x86_64-linux-gnu/libpng.a
export Z_LIB=/usr/lib/x86_64-linux-gnu/libz.a
export JASPER_LIB=/usr/lib/x86_64-linux-gnu/libjasper.a
export G2_LIB4=/usr/local/g2-3.4.1/lib/libg2_4.a
export W3NCO_LIB4=/usr/local/w3nco-2.4.1/lib/libw3nco_4.a
export BACIO_LIB4=/usr/local/bacio-2.4.1/lib/libbacio_4.a
Model compilation
sudo ./model/bin/w3_setup model -c gnu -s NCEP_glwu
cd model/bin sudo ./w3_make ww3_grib
As indicated above, NCEP_glwu is a modified version without the switches NOPA
and LRB4
. I am using gnu compiler since if I use the same code but replacing -c gnu
by -c intel
I get the next error:
/home/tesalia/WW3/model/bin/ad3: línea 215: ifort: command not found
*** w3adc error ***
file constants.F90 not found (2)
I do not know why the intel compiler does not work (my system has installed ifort 2021.4.0) or why linking the ww3_grib file always produces a linking error if all the required libraries and the environment variables have been set.