CFITSIO switched to a 3-field version numbering format with version 4.0.0 [1] breaking healpix builds.
[ 37s] In file included from cxxsupport/fitshandle.cc:36:
[ 37s] /usr/include/cfitsio/fitsio.h:37:25: error: too many decimal points in number
[ 37s] 37 | #define CFITSIO_VERSION 4.0.0
[ 37s] | ^~~~~
[ 37s] cxxsupport/fitshandle.cc:802:42: note: in expansion of macro 'CFITSIO_VERSION'
[ 37s] 802 | int v_header = nearest<int>(1000.*CFITSIO_VERSION),
[ 37s] | ^~~~~~~~~~~~~~~
[ 37s] cxxsupport/fitshandle.cc: In constructor '{anonymous}::cfitsio_checker::cfitsio_checker()':
[ 37s] cxxsupport/fitshandle.cc:804:21: error: 'v_library' was not declared in this scope
[ 37s] 804 | if (v_header!=v_library)
[ 37s] | ^~~~~~~~~
[1] https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/docs/changes.txt
Anonymous
Something like this patch seems to work:
Thanks a lot for the report and the patch! I'll integrate this as soon as possible.
Should be fixed on trunk now. Thanks again!
I have no idea how, but the patch was not properly applied. Fixing this now.
I walked into the same issue today, my solutoin (after confirming with the cfitsio developers how
fits_get_versionwill behave in the future is simpler:This is the answer I received from the cfitsio maintainers:
Thanks for the patch. It is now also available in the release specific branch:
https://sourceforge.net/p/healpix/code/HEAD/tree/branches/branch_v380r1183/src/cxx/cxxsupport/fitshandle.cc
fixed in v3.81
The patch submitted by Atri worked fine with cfitsio 4.00 but fails with 4.01. Looks like the cfitsio developers use 2 rather than 3 digits for the version fields.
Fix is to use the code submitted by Anonymous on 2021-11-17 or use this modified version of the patch: https://github.com/hpc4cmb/libconviqt/blob/master/levels/cxxsupport/fitshandle.cc#L814-L828.
Personally, I prefer comparing integers rather than floats.
Thanks! I applied the fix on the trunk.
Eric, should I update the 3.81 branch too?
If anyone could double-check that everything works, that would be great.
Hi Martin,
On 30/03/2022 10:43, Martin Reinecke wrote:
Eric
Related
Bugs:
#122This error also occur in my compilation. When I run the program, a warning will print, says that header versio not matched, so I tracked this error then I found the bug, in fact in cfitsio.4.1.0, the version was calculated in format: MAJOR + 0.01xMINOR + 0.0001xMICRO, so the right header version should be 1E6MAJOR + 1E4MINOR+1E2*MICRO.