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

searching for nc_def_var_szip but szip is not enabled #458

Open
gcapodagAMD opened this issue Dec 7, 2024 · 0 comments
Open

searching for nc_def_var_szip but szip is not enabled #458

gcapodagAMD opened this issue Dec 7, 2024 · 0 comments

Comments

@gcapodagAMD
Copy link

gcapodagAMD commented Dec 7, 2024

I am building netcdf-fortran (version 4.6.2-rc1) without enabling szip for hdf5 (version 1.14.5) and netcdf-c (version 4.9.3-rc1), but nc_def_var_szip is still searched for and when it is not found, the error here is thrown:

                      "If netCDF-C 4.7.4 is present but is built statically, you *must* specify all dependencies"
                      "by setting the LDFLAGS environmental variable.\n"
                      "Example:\n"
                      "    $ export LDFLAGS=$(nc-config --libs)"

Do this line:
CHECK_LIBRARY_EXISTS(${NETCDF_C_LIBRARY} nc_def_var_szip "" HAVE_DEF_VAR_SZIP)
and the block of code after need to be guarded with an if statement on whether szip is enabled? The trick of adding set(HAVE_DEF_VAR_SZIP TRUE) before if (NOT HAVE_DEF_VAR_SZIP) makes the installation work.

To reproduce, this is how I am building HDF5:

 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release \
  			        -DHDF5_BUILD_TOOLS:BOOL=ON -DCMAKE_INSTALL_PREFIX=${HDF5_PATH} \
                                -DZLIB_ROOT=${HDF5_PATH}/zlib \
				-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \
                                -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
                                -DCMAKE_C_COMPILER=${C_COMPILER} \
				-DCMAKE_Fortran_COMPILER=${FC_COMPILER} \
				-DBUILD_TESTING:BOOL=OFF \
				-DHDF5_ENABLE_PARALLEL:BOOL=ON \
				-DHDF5_BUILD_FORTRAN:BOOL=ON 


cmake --build . --config Release

cpack -C Release CPackConfig.cmake

./HDF5-${HDF5_VERSION}-Linux.sh --prefix=${HDF5_PATH} --skip-license

This is how I am building NETCDF-C:

cmake -DCMAKE_INSTALL_PREFIX=${NETCDF_PATH}/netcdf-c \
-DNETCDF_ENABLE_HDF5=ON \
-DNETCDF_ENABLE_DAP=ON  \
-DNETCDF_BUILD_UTILITIES=ON \
-DNETCDF_ENABLE_PNETCDF=OFF \
-DNETCDF_ENABLE_CDF5=ON \
-DNETCDF_ENABLE_TESTS=OFF \
-DNETCDF_ENABLE_PARALLEL_TESTS=OFF \
-DZLIB_INCLUDE_DIR=${HDF5_ROOT}/zlib/include \
-DCMAKE_C_FLAGS="-I ${HDF5_ROOT}/include/" \
-DCMAKE_C_COMPILER=${C_COMPILER} \
-DNETCDF_ENABLE_PNETCDF=ON \
-DPNETCDF_LIBRARY=${NETCDF_PATH}/pnetcdf/lib/libpnetcdf.so \
-DPNETCDF_INCLUDE_DIR=${NETCDF_PATH}/pnetcdf/include \
-DNETCDF_ENABLE_FILTER_SZIP=OFF \
-DNETCDF_ENABLE_NCZARR=OFF

make install

This is how I am building NETCDF-Fortran:

export PATH=${NETCDF_PATH}/netcdf-c:$PATH
export HDF5_PLUGIN_PATH=${NETCDF_PATH}/netcdf-c/hdf5/lib/plugin/
cmake -DCMAKE_INSTALL_PREFIX=${NETCDF_PATH}/netcdf-fortran \
-DENABLE_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DCMAKE_Fortran_COMPILER=$FC_COMPILER 

 make install
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