Open philrosenberg opened 3 months ago
Even though you can install NetCDF-C and NetCDF-Fortran as part of the conda Python environment, I recommend you install them separately. We have install scripts in https://github.com/EPIC-model/epic/tree/main/dependencies that could give you a starting point. You can export the environment variables NETCDF_C_DIR
and NETCDF_FORTRAN_DIR
afterwards such that the configure script of EPIC finds your installations. I hope this helps.
Ah - I read the manual as either use the scripts or use the conda environment, rather than both.
We only use the conda environment for our Python plotting and post-processing scripts. It is up to you really. Note that you also need a working MPI installation. I usually use OpenMPI.
I tried building the netcdf and hdf5 libraries using the script, but I still get the same error regarding the F90 functions and readelf still shows the f90 functions don't appear to be present in libnetcdff.so
I think I'm stuck at the limit of my fortran/linux library knowledge now
Just to understand: Could you successfully install HDF5, netCDF-C and netCDF-Fortran? If so, the next steps are
You should also ensure that you do not configure with the netCDF version of the conda environment. You should probably check the file config.log
in the build directory.
I have had a further play around and I think the problem might be with the configure script.
on line 16847 there is a line
LIBS="-l$lib $LIBS"
If I output the value of libs to the screen at that point I get
-lnetcdff no
I think the no
is left over from the first look iteration, where it uses NONE
for the library
If I replace this line with
LIBS=`nf-config --flibs --fflags`
then the configure runs to the end.
However, there is a snag. In all the Makefile
s I get the include command on a separate line after the LIBS
variable is defined.
This causes an error in the Makefile
due to the newline. If I go through all the Makefile
s and remove the newline, then epic builds. However, I guess these include directories probably shouldn't be in the LIBS
variable.
I'm kindof pushing at the boundaries of my knowledge of linux build systems, but maybe you know how to tidy this up properly and make sure the test code at this location gets the correct flags.
There should be no need for all of this. I think it still finds the conda netCDF installation. Could you ensure this is not happening? Also carefully check config.log
.
I will have another look when I'm back in the office on Tuesday
When following the installation procedure during the
../configure
step I received the errorconfigure: error: No NETCDF_C_DIR environment variable.
Checking the configure script, this environment variable is used to set the default location for the netcdf C library and another similar variable is used to set the default location for the netcdf fortran library.
Neither are set. I was able to work around the configure error for the C directory by adding
--with-netcdf-c=`nc-config --libs | cut -d " " -f 1 | cut -c3-`
to my configure command. Perhaps there is a better way?
This then resulted in a similar error, but for the
NETCDF_FORTRAN_DIR
environment variable.It turns out that netcdf fortran was not installed as part of the requirements. It used to be that the fortran and C libraries were packaged together, but that is no longer the case (see https://docs.unidata.ucar.edu/netcdf-c/current/building_netcdf_fortran.html). I installed the fortran package with
conda install netcdf-fortran
The equivalent configure argument to get the netcdf-fortran is
--with-netcdf-fortran=`nf-config --flibs | cut -d " " -f 1 | cut -c3-`
however this gave me the following error when running the configure script
checking for function nf90_open... no
checking for function nf90_open in -lnetcdff... no
checking whether we can compile a NetCDF Fortran program... no
calling
readelf -s /path/to/conda/env/lib/libnetcdff.so | grep open
showed that there was no function with thenf90_
prefix, onlynf_
prefix, which is the fortran 77 functionThe link above indicates that the package can be built with or without f90 support, so perhaps this version is built without. Maybe I need to build fortran netcdf myself or maybe there is some other package