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

Error: Symbol 'nc_noquantize' at (1) has no IMPLICIT type; did you mean 'nf_noquantize'? with netCDF 4.9.2 and netcdf-fortran-4.6.1 #427

Closed
agahirpa opened this issue Jan 3, 2024 · 14 comments
Assignees

Comments

@agahirpa
Copy link

agahirpa commented Jan 3, 2024

I am trying to compile netcdf-fortran-4.6.1 with netcdf-c 4.9.2 and I get the following error on ubuntu 22.02.

$ make check install
Making check in libsrc
make[1]: Entering directory '/home/agahirpa/WRF-Hydro/netcdf-fortran-4.6.1/libsrc'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/home/agahirpa/WRF-Hydro/netcdf-fortran-4.6.1/libsrc'
Making check in fortran
make[1]: Entering directory '/home/agahirpa/WRF-Hydro/netcdf-fortran-4.6.1/fortran'
/bin/bash ../libtool  --tag=FC   --mode=compile gfortran -DPACKAGE_NAME=\"netCDF-Fortran\" -DPACKAGE_TARNAME=\"netcdf-fortran\" -DPACKAGE_VERSION=\"4.6.1\" -DPACKAGE_STRING=\"netCDF-Fortran\ 4.6.1\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DPACKAGE=\"netcdf-fortran\" -DVERSION=\"4.6.1\" -DNF_RELAX_COORD_BOUND=1 -DENABLE_CDF5=1 -DNF_HAS_QUANTIZE=1 -DHAVE_F2008=1 -DHAVE_TS29113_SUPPORT=1 -DTEMP_LARGE=\".\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DNF_INT1_T=byte -DNF_INT2_T=integer\*2 -DNF_INT8_T=integer\*8 -DNF_INT1_IS_C_SIGNED_CHAR=1 -DNF_INT2_IS_C_SHORT=1 -DNF_INT8_IS_C_LONG_LONG=1 -DNF_INT_IS_C_INT=1 -DNF_REAL_IS_C_FLOAT=1 -DNF_DOUBLEPRECISION_IS_C_DOUBLE=1 -DNCBYTE_T=byte -DNCSHORT_T=integer\*2 -DHAVE_LIBM=1 -DHAVE_NETCDF_H=1 -DHAVE_NC_DEF_OPAQUE=1 -DHAVE_NCCREATE=1 -DHAVE_NC_SET_LOG_LEVEL=1 -DHAVE_NC_DEF_VAR_SZIP=1 -DLOGGING=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_LOCALE_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDARG_H=1 -DHAVE_ERRNO_H=1 -DHAVE_CTYPE_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_VPRINTF=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SSIZE_T=1 -DHAVE_PTRDIFF_T=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DSIZEOF_OFF_T=8 -DSIZEOF_SIZE_T=8 -DSIZEOF_PTRDIFF_T=8 -I.   -I//home/agahirpa/local/include -I. -g -O2 -fallow-argument-mismatch -c -o module_netcdf_nf_data.lo module_netcdf_nf_data.F90
libtool: compile:  gfortran -DPACKAGE_NAME=\"netCDF-Fortran\" -DPACKAGE_TARNAME=\"netcdf-fortran\" -DPACKAGE_VERSION=\"4.6.1\" "-DPACKAGE_STRING=\"netCDF-Fortran 4.6.1\"" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DPACKAGE=\"netcdf-fortran\" -DVERSION=\"4.6.1\" -DNF_RELAX_COORD_BOUND=1 -DENABLE_CDF5=1 -DNF_HAS_QUANTIZE=1 -DHAVE_F2008=1 -DHAVE_TS29113_SUPPORT=1 -DTEMP_LARGE=\".\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DNF_INT1_T=byte "-DNF_INT2_T=integer*2" "-DNF_INT8_T=integer*8" -DNF_INT1_IS_C_SIGNED_CHAR=1 -DNF_INT2_IS_C_SHORT=1 -DNF_INT8_IS_C_LONG_LONG=1 -DNF_INT_IS_C_INT=1 -DNF_REAL_IS_C_FLOAT=1 -DNF_DOUBLEPRECISION_IS_C_DOUBLE=1 -DNCBYTE_T=byte "-DNCSHORT_T=integer*2" -DHAVE_LIBM=1 -DHAVE_NETCDF_H=1 -DHAVE_NC_DEF_OPAQUE=1 -DHAVE_NCCREATE=1 -DHAVE_NC_SET_LOG_LEVEL=1 -DHAVE_NC_DEF_VAR_SZIP=1 -DLOGGING=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_LOCALE_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDARG_H=1 -DHAVE_ERRNO_H=1 -DHAVE_CTYPE_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_VPRINTF=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SSIZE_T=1 -DHAVE_PTRDIFF_T=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DSIZEOF_OFF_T=8 -DSIZEOF_SIZE_T=8 -DSIZEOF_PTRDIFF_T=8 -I. -I//home/agahirpa/local/include -I. -g -O2 -fallow-argument-mismatch -c module_netcdf_nf_data.F90  -fPIC -o .libs/module_netcdf_nf_data.o
module_netcdf_nf_data.F90:167:54:

  167 |  Integer, Parameter :: NF_NOQUANTIZE   = NC_NOQUANTIZE
      |                                                      1
Error: Symbol 'nc_noquantize' at (1) has no IMPLICIT type; did you mean 'nf_noquantize'?
module_netcdf_nf_data.F90:168:67:

  168 |  Integer, Parameter :: NF_QUANTIZE_BITGROOM  = NC_QUANTIZE_BITGROOM
      |                                                                   1
Error: Symbol 'nc_quantize_bitgroom' at (1) has no IMPLICIT type; did you mean 'nf_quantize_bitgroom'?
make[1]: *** [Makefile:766: module_netcdf_nf_data.lo] Error 1
make[1]: Leaving directory '/home/agahirpa/WRF-Hydro/netcdf-fortran-4.6.1/fortran'
make: *** [Makefile:588: check-recursive] Error 1

I used the following:
CPPFLAGS=-I//home/agahirpa/local/include LDFLAGS="-L/home/agahirpa/local/lib -Wl,-rpath,/home/agahirpa/local/lib -lnetcdf" ./configure --prefix=/home/agahirpa/local --disable-dependency-tracking

with the output from nc-config --all is below.
The netcdf-c was compiled with:

$ ./configure --prefix=/home/agahirpa/local --disable-netcdf-4 --disable-dap
$ make check install
This netCDF 4.9.2 has been built with the following features:

  --cc            -> gcc
  --cflags        -> -I/home/agahirpa/local/include
  --libs          -> -L/home/agahirpa/local/lib -lnetcdf
  --static        -> -lm -lsz -lxml2 -lcurl
  --has-dap          -> no
  --has-dap2         -> no
  --has-dap4         -> no
  --has-nc2          -> yes
  --has-nc4          -> yes
  --has-hdf5         -> no
  --has-hdf4         -> no
  --has-logging      -> no
  --has-pnetcdf      -> no
  --has-szlib        -> yes
  --has-cdf5         -> yes
  --has-parallel4    -> no
  --has-parallel     -> no
  --has-nczarr       -> yes
  --has-zstd         -> no
  --has-benchmarks   -> no
  --has-multifilters -> yes
  --has-stdfilters   -> deflate bz2
  --has-quantize     -> yes

  --prefix           -> /home/agahirpa/local
  --includedir       -> /home/agahirpa/local/include
  --libdir           -> /home/agahirpa/local/lib
  --plugindir        ->
  --version          -> netCDF 4.9.2

I don't know what I did wrong.

@WardF WardF self-assigned this Jan 5, 2024
@WardF
Copy link
Member

WardF commented Jan 5, 2024

This should be working, so it is a little unusual that it's not. Can you attach the config.log file generated when you run configure on netCDF-Fortran 4.6.1? You may need to rename it to config.log.txt in order for GitHub to accept it as an upload.

@agahirpa
Copy link
Author

agahirpa commented Jan 5, 2024

This should be working, so it is a little unusual that it's not. Can you attach the config.log file generated when you run configure on netCDF-Fortran 4.6.1? You may need to rename it to config.log.txt in order for GitHub to accept it as an upload.

Thank you for looking into this.
Attached is the config log file
config.log.txt

@jshn9515
Copy link

I have the same problem compiling netcdf-fortran-4.6.1 with netcdf-c 4.9.2 on CentOS 7.9.

@WardF
Copy link
Member

WardF commented Jan 11, 2024

Thank you; I'm still trying to sort out what is going on here, insofar as I've been unable to replicate the issue as of yet. From the config.log file you provided, @agahirpa, it looks like you're using Ubuntu 22.02 under WSL on a Windows host. Is this correct? @jshn9515 would you be able to provide your config.log file as well?

@agahirpa
Copy link
Author

Thank you; I'm still trying to sort out what is going on here, insofar as I've been unable to replicate the issue as of yet. From the config.log file you provided, @agahirpa, it looks like you're using Ubuntu 22.02 under WSL on a Windows host. Is this correct? @jshn9515 would you be able to provide your config.log file as well?

@WardF that is correct: I am using Ubuntu 22.02 under WSL on a Window.

@jshn9515
Copy link

jshn9515 commented Jan 12, 2024

Thank you for looking this. I think it is similar to #414.
config.log.txt

After setting NF_NOQUANTIZE to 0 and NF_QUANTIZE_BITGROOM to 1, the issue was resolved. However, another error occurred:

netcdf.F90:47:2:

 #include "netcdf_externals.f90"
  1~~~~~~~~~~~~~~~~~~~~~
Fatal Error: netcdf_constants.f90: No such file or directory
compilation terminated.
make[1]: *** [Makefile:766: netcdf.lo] Error 1

The include statements are *.f90 but the actual files are *.F90.

@jshn9515
Copy link

jshn9515 commented Jan 12, 2024

After completing the following steps, the compilation is successful, and all tests have passed:

  1. Change all occurrences of *.f90 to *.F90 in the include statements within netcdf.F90.
  2. Add #define USE_NETCDF4 before #ifdef USE_NETCDF4 in module_netcdf_nc_data.F90.
  3. Copy typeSizes.F90 and save as module_typesizes.F90.

@WardF
Copy link
Member

WardF commented Jan 12, 2024

Thanks @jshn9515 I am taking a look at making these changes, thanks!

@agahirpa
Copy link
Author

Thanks a lot!

@WardF WardF closed this as completed Jan 16, 2024
@jshn9515
Copy link

jshn9515 commented Mar 3, 2024

Well... I finally find out the reason I receive these errors is that I had built the NetCDF-C library with the --disable-netcdf-4 option, which caused the NetCDF-Fortran library to be unable to find the USE_NETCDF4 symbol. Once I built NetCDF-C without this option, the original code was able to run without any need for modification.

@Rdfing
Copy link

Rdfing commented Mar 27, 2024

Well... I finally find out the reason I receive these errors is that I had built the NetCDF-C library with the --disable-netcdf-4 option, which caused the NetCDF-Fortran library to be unable to find the USE_NETCDF4 symbol. Once I built NetCDF-C without this option, the original code was able to run without any need for modification.

By any chance you find a solution for this issue? I ran into the same problem. But in my case, even I build the NetCDF-C with netCDF-4, the make check in the NetCDF-F still complains

@jshn9515
Copy link

I have no idea about that. Maybe you can open a new issue and describe that problem.

@Rdfing
Copy link

Rdfing commented Mar 28, 2024

I have no idea about that. Maybe you can open a new issue and describe that problem.

Do you mind sharing your method for compiling the NetCDF 4.9.2 and NetCDF-fortran-4.6.1?

Thanks

@jshn9515
Copy link

I built them on CentOS 7.9 with GCC 11.2.1.
For NetCDF-C:

ZDIR=/usr/local
H5DIR=/usr/local
NCDIR=/usr/local
CPPFLAGS='-I${H5DIR}/include -I${ZDIR}/include'
LDFLAGS='-L${H5DIR}/lib -L${ZDIR}/lib'
./configure --prefix=${NCDIR}
make -j 4
make check
make install

And for NetCDF-Fortran:

NCDIR=/usr/local
NFDIR=/usr/local
CC=/usr/local/cc
FC=/usr/local/fortran
CPPFLAGS=-I${NCDIR}/include
LDFLAGS=-L${NCDIR}/lib
./configure --prefix=${NFDIR}
make -j 4
make check
make install

By the way, make sure all the dependencies have been installed correctly with all tests passed.

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

4 participants