Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split C/Fortran netCDF installations fails with multiple library directories in CMake #699

Open
scrasmussen opened this issue Jun 23, 2023 · 1 comment

Comments

@scrasmussen
Copy link
Member

Expected Behavior

CMake build finds the Fortran NetCDF library when the NetCDF C and Fortran installation are in different directories.

Current Behavior

The line

    find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs}  HINTS "${NetCDF_lib_dirs}" NO_DEFAULT_PATH)

is only searching the path where the C library is installed, but the Fortran NetCDF library is installed is a separate directory.

Possible Solution

Choose one of the following or maybe something else

  • Edit this line in FindNetCDF.cmake so it can find the Fortran NetCDF installation.
    • Add another HINT variable that would point to the Fortran Path
    • Removing NO_DEFAULT_PATH worked
  • Have a CMakeLists.txt or the FindNetCDF.cmake file extract and use the path from nf-config --flibs, it will have the Fortran installation.

Steps to Reproduce (for bugs)

  1. On Cheyenne load the JEDI Spack modules
module purge
export LMOD_TMOD_FIND_FIRST=yes

module use /glade/work/jedipara/cheyenne/spack-stack/modulefiles/misc
module load miniconda/3.9.12
module load ecflow/5.8.4
module load mysql/8.0.31

module use /glade/work/epicufsrt/contrib/spack-stack/spack-stack-1.4.0/envs/unified-env-v2/install/modulefiles/Core
module load stack-gcc/10.1.0
module load stack-openmpi/4.1.1
module load stack-python/3.9.12
module load jedi-base-env
  1. Try and build WRF-Hydro with basic CMake commands: mkdir build; cd build; cmake ..

Your Environment

  • Version of the code used: main branch
  • Operating System and version: Cheyenne
  • Compiler and version: GNU 10.1.0
  • Other relevant information: Using Spack Modules so NetCDF C and Fortran installations are in different directories
@scrasmussen
Copy link
Member Author

Semi related to issue #683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant