Open jamal919 opened 2 years ago
For now, I am avoiding such mismatch by explicitly defining NetCDF_C
environment variable, either by
export NetCDF_C=/usr/lib/x86_64-linux-gnu/
cmake -C ../cmake/SCHISM.local.build -C ../cmake/SCHISM.local.ubuntu ../src -DNetCDF_C=/usr/lib/x86_64-linux-gnu/
Thanks.
Dear Jamal, thanks for reporting this. I am not an export in CMake
either but I have encountered problems with multiple netcdf libs installed system-wide and through conda persistently. So thank you for your fix.
You may also move the -DNetCDF_C=/usr/lib/x86_64-linux-gnu/
into a CMake.local
definition file for your system in the cmake
subdirectory
Here's the CMakeCache.txt
from my system with macports and anaconda installed. Same problem
//NetCDF nc-config helper
NetCDF_C_CONFIG_EXECUTABLE:FILEPATH=/opt/local/bin/nc-config
//NetCDF C include directory
NetCDF_C_INCLUDE_FILE:FILEPATH=/opt/local/include/netcdf.h
//NetCDF C library
NetCDF_C_LIBRARY:STRING=/opt/homebrew/anaconda3/lib/libnetcdf.dylib
So the nc-config
and --includedir
are correctly assigned, but the library is taken from anaconda; also the same for the Fortran part.
Setting -DNetCDF_C
did not remedy this.
Hi Carsten,
Have you tried a fresh build directory. I remember that the first time I was trying I already had CMakeCache.txt with old values and setting -DNetCDF_C
did not help. Then after cleaning the build directory (rm -rf
) the values were properly set. Could be a solution for you.
I have no experience with mac system, and no way to reproduce this behaviour either in similar environment.
Hi Carsten @platipodium,
Did you finally found a way to make the cmake to pick up NetCDF correctly? I am just curious based on your recent commit ebb27b60621e9dd4c83f87f11621f15dfd97fd30
Works for me, but only after removing conda from my PATH
(despite the hints given in the cmake
config files)
Hi all,
I was trying to build SCHISM with cmake build system in a new Ubuntu machine (Ubuntu 20.04.3 LTS). I have installed necessary packages through apt - compilers, netcdf (c and fortran), mpich, cmake etc. I have also anaconda installed on my computer in home directory
~/.anaconda3
.If I issue the cmake configure command
cmake -C ../cmake/SCHISM.local.build -C ../cmake/SCHISM.local.ubuntu ../src -DUSE_WWM=on
, the output has something weird - it picks up the fortran netcdf fine, but links to the netcdf-c library inside~/.anaconda
Then afterwards, if I build schism, the executables are created fine! But they fail during execution - whenever NetCDF is involved.
My experience with cmake is rather short. I tried passing the NetCDF_ROOT variable to FindNetCDF.cmake through -DNetCDF_ROOT flag, but no avail.
Any fix for this issue? (Other than, of course, editing CMakeCache.txt by hand).
Thanks.
Edit: The problem is reproduced in multiple machines with different software configurations, but with existence of anaconda in home directory.