mariapaula.perez-pena@erm
New member
Hello WRF community! I've been stuck on compiling issues for a week and I'm reaching out as none of the solutions I've tried so far seem to work.
I am trying to compile WRF in a WSL that runs Ubuntu 22.04.5. I followed the steps in the WRF Tutorial after setting up the machine with
The system passed all the tests suggested in the WRF Tutorial.
Following this, I came across the issues with the compilation of netCDF-c v 4.7.2 and followed the recommendations here as the error was similar. However, as pointed out at the end of the thread, the change of $CC -V for $CC -v and the commenting out of the section for tests did not work either.
Digging further, a more recent post suggests a work around by modifying the FFLAGS and FCFLAGS (recommended here) to ensure compatibility with legacy Fortran code. This seemed to solve the issue and netCDF-c v 4.7.2 and netcdf-fortran v 4.5.2 compiled (the current -Sep 2024- suggested versions in the tutorial). All the other libraries compiled with no issues (i.e., zlib, lipbng and jasper). The environment variables that I used throughout the process are in the attached file "variables.txt" file and follow the recommendations made by another post in this forum ("Build_WRF_GNU_Environment.pdf"). Note that I have not tried to compile HDF5 as suggested in the pdf file attached based on the fact that the WRF tutorial does not consider it.
However, WRF compilation failed and upon inspecting the log file the error seemed to be related with a faulty compilation of netCDF - see error below
Moving forward, I decided to clean the entire WSL set-up, begin again and update the netCDF-c and fortran to the later versions 4.9.2 and 4.6.1 respectively. The compilation of netCDF remains faulty although dependencies are created in the netcdf/ folder. Plagued with errors (see attached the config_netCDFc.log) both netCDF c and fortran compiled, and I wanted to explore further what would the error be in WRF. Clearly it does not compile, but it also gives another error related with curl (inherited from the faulty netCDF compilation?):
The "compile.WRF.log" file shows a set of errors like the one above.
This is (I think) clearly a set up issue from the start, but I am lost as to how to solve it, as I've tried cleaning all up, but the steps are the same and in turn I keep running into the same problem. So, after this lengthy story, I would really appreciate it
:
1) Any suggestion(s) or insight on how to set up the WSL environment properly other than what I've described above.
2) If you can advise on the use of the latest netCDF libraries to compile WRF or if this should be avoided and just the previous versions are the ones to use.
3) If it is preferable to install HDF5 and build netCDF with it
4) The consistency of the environment variables across the compilation of the libraries, I am using the same ones for all but (and this is clearly not my area of expertise) I don't know if they should be changed depending on the library being compiled.
P.D I know that the forum is not supposed to address netCDF issues but I've explored as much as I could on netCDF forums and other places and was hoping that someone here in the community has a better grasp on how to overcome these issues.
Thank you so much for taking the time to read and answer, it is greatly appreciated.
Cheers,
I am trying to compile WRF in a WSL that runs Ubuntu 22.04.5. I followed the steps in the WRF Tutorial after setting up the machine with
Code:
$ sudo apt-get update
$ sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev libxml2-dev
The system passed all the tests suggested in the WRF Tutorial.
Following this, I came across the issues with the compilation of netCDF-c v 4.7.2 and followed the recommendations here as the error was similar. However, as pointed out at the end of the thread, the change of $CC -V for $CC -v and the commenting out of the section for tests did not work either.
Digging further, a more recent post suggests a work around by modifying the FFLAGS and FCFLAGS (recommended here) to ensure compatibility with legacy Fortran code. This seemed to solve the issue and netCDF-c v 4.7.2 and netcdf-fortran v 4.5.2 compiled (the current -Sep 2024- suggested versions in the tutorial). All the other libraries compiled with no issues (i.e., zlib, lipbng and jasper). The environment variables that I used throughout the process are in the attached file "variables.txt" file and follow the recommendations made by another post in this forum ("Build_WRF_GNU_Environment.pdf"). Note that I have not tried to compile HDF5 as suggested in the pdf file attached based on the fact that the WRF tutorial does not consider it.
However, WRF compilation failed and upon inspecting the log file the error seemed to be related with a faulty compilation of netCDF - see error below
Code:
F90:2201: undefined reference to `nc_set_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
Command exited with non-zero status 1
0.03user 0.04system 0:00.11elapsed 66%CPU (0avgtext+0avgdata 17812maxresident)k
0inputs+0outputs (0major+7242minor)pagefaults 0swaps
make[2]: [makefile:45: diffwrf] Error 1 (ignored)
Moving forward, I decided to clean the entire WSL set-up, begin again and update the netCDF-c and fortran to the later versions 4.9.2 and 4.6.1 respectively. The compilation of netCDF remains faulty although dependencies are created in the netcdf/ folder. Plagued with errors (see attached the config_netCDFc.log) both netCDF c and fortran compiled, and I wanted to explore further what would the error be in WRF. Clearly it does not compile, but it also gives another error related with curl (inherited from the faulty netCDF compilation?):
Code:
/usr/bin/ld: /mnt/d/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): undefined reference to symbol 'curl_easy_cleanup@@CURL_OPENSSL_4'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcurl.so.4: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Command exited with non-zero status 1
0.01user 0.03system 0:00.08elapsed 55%CPU (0avgtext+0avgdata 17896maxresident)k
0inputs+0outputs (0major+7480minor)pagefaults 0swaps
The "compile.WRF.log" file shows a set of errors like the one above.
This is (I think) clearly a set up issue from the start, but I am lost as to how to solve it, as I've tried cleaning all up, but the steps are the same and in turn I keep running into the same problem. So, after this lengthy story, I would really appreciate it

1) Any suggestion(s) or insight on how to set up the WSL environment properly other than what I've described above.
2) If you can advise on the use of the latest netCDF libraries to compile WRF or if this should be avoided and just the previous versions are the ones to use.
3) If it is preferable to install HDF5 and build netCDF with it
4) The consistency of the environment variables across the compilation of the libraries, I am using the same ones for all but (and this is clearly not my area of expertise) I don't know if they should be changed depending on the library being compiled.
P.D I know that the forum is not supposed to address netCDF issues but I've explored as much as I could on netCDF forums and other places and was hoping that someone here in the community has a better grasp on how to overcome these issues.
Thank you so much for taking the time to read and answer, it is greatly appreciated.
Cheers,