netcdf-c
netcdf-c copied to clipboard
Incompatible function pointer when building with clang-16
I am experiencing errors when compiling netcdf 4.9.2 with clang-16 and hdf5 1.14.1. Compiling with clang-15 and same hdf5 version works fine.
OS: macOS Ventura 13.4 (arm)
_ports_science_netcdf/netcdf/work/netcdf-c-4.9.2/libhdf5/hdf5open.c
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.9.2/libhdf5/hdf5open.c:2902:20: error: incompatible function pointer types passing 'int (hid_t, const char *, const H5L_info2_t *, void *)' (aka 'int (long long, const char *, const H5L_info2_t *, void *)') to parameter of type 'H5L_iterate1_t' (aka 'int (*)(long long, const char *, const H5L_info1_t *, void *)') [-Wincompatible-function-pointer-types]
read_hdf5_obj, (void *)&udata) < 0)
^~~~~~~~~~~~~
/opt/local/include/H5Lpublic.h:1684:42: note: passing argument to parameter 'op' here
H5L_iterate1_t op, void *op_data);
^
1 error generated.
Interesting, thank you for letting us know. I will take a look.
Taking a look at fixing this, I'm now observing it again after merging #2958. @edwardhartnett do you folks use clang at all? I'm uncertain why this passed the MacOS CI but fails locally using clang.
No we don't use clang.
I'm also seeing this on Frontier builds with Cray and v4.9.2:
InstalledDir: /opt/cray/pe/cce/17.0.0/cce-clang/x86_64/share/../bin Configuration file: /opt/cray/pe/cce/17.0.0/cce-clang/x86_64/bin/clang.cfg
v4.9.3-rc1 does not have an issue and successfully compiled.
Thanks for confirming @brtnfld. I'm prepping the netCDF-Fortran rc1 to go out tomorrow, although there appears to be an FPE-related issue in netCDF-Fortran (reported via our eSupport system) that I am going to open as a github issue; it may need to be addressed at a higher priority once I confirm it.