Cfitsio & fortran wrap

Some time ago, I reported problem with compilation of Munipack under Mandriva linux distribution. Today's work under Gentoo make my way where the trouble is occuring. Errors like these:

autoflat.f90:(.text+0x8ee): undefined reference to `ftopen_'
autoflat.f90:(.text+0x93f): undefined reference to `ftghpr_'
autoflat.f90:(.text+0x9da): undefined reference to `ftclos_'

says: You have the cfitsio library installed but the functions has not been found. The problem will appear in "modern" distributions without g77 binary (any f77 compiler), while cfitsio configure script is looking for f77 compiler. If the compiler is not found, the configure-machinery drop off support of f77. It is indicated by:

checking for f77... no
checking for xlf... no
checking for cf77... no
checking for gf77... no
checking for g77... no
checking for af77... no
checking for ncf... no
checking for f2c... no
configure: warning: cfitsio: == No acceptable f77 found in $PATH
configure: warning: cfitsio: == Cfitsio will be built without Fortran wrapper support

It can be easy verified by simple runnig of g77 (f77 will be not accessible).


This is a bug in cfitsion library so we will wait for correction by authors (it is done now in cfitsio-3.06, but the correction is not included in "modern" distributions). In meantime, the best solution of this is recompilation of the cfitsio with creation of a "g77" compiler wrapper. The wrapper can be created as a shell script:

gfortran $*

or as link

ln -s /usr/bin/gfortran g77

in any appropriate directory (~/bin,/usr/local/bin) and followed by the complete recompilation of the cfitsio library. This new library .a needs be placed to a system-wide linker path (/usr/local/lib).

The nm utility can help with inspection of the cfitsio library. The gfortran is pretty compatible with g77.
Post a Comment