slang-devel mailing list

[2021 Date Index] [2021 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-devel] Compilation of slcfitsio fails against libcfitsio 4.0.0


Dear S-Lang developers,

I do not know whether it is appropriate to post in this mailing list bug reports against the slcfitsio module. Please, tell me if there is a more appropriate forum.

When building the slcfitsio module against libcfitsio version 4.0.0, the compilation fails with the following error message:

   In file included from cfitsio-module.c:10:
   cfitsio-module.c: In function ‘check_version’:
   cfitsio-module.c:2421:23: error: too many decimal points in number
    2421 |    compiled_version = CFITSIO_VERSION;
         |                       ^~~~~~~~~~~~~~~

This happens because, in previous releases of libcfitsio, the version number stored in the CFITSIO_VERSION macro was a float number (it is currently "4.0.0").

The patch attached to this message provides a possible solution for the problem, by compiling and running a program (cfitsio-version.c) at build time. The executable the cfitsio-version.h file containing the definition of the macro COMPILED_CFITSIO_VERSION, which is a float number, that is used in cfitsio-module.c at run time.

Please, consider integrating it in the next release of slcfitsio or providing a better solution.

Best,

Rafael Laboissière

P.S.: This issue has been reported against the slang-cfitsio package in Debian (https://bugs.debian.org/994673). It will be fixed temporarily with the patch attached here.
Description: Fix compilation error involving CFITSIO_VERSION
 When building the slcfitsio module against libcfitsio version 4.0.0,
 the compilation fails with the following error message:
 .
   In file included from cfitsio-module.c:10:
   cfitsio-module.c: In function ‘check_version’:
   cfitsio-module.c:2421:23: error: too many decimal points in number
    2421 |    compiled_version = CFITSIO_VERSION;
         |                       ^~~~~~~~~~~~~~~
 .
 This happens because, in previous releases of libcfitsio, the version
 number stored in the CFITSIO_VERSION macro was a float number (it is
 currently "4.0.0").
 .
 This patch provides a possible solution for the problem, by compiling
 and running a program (cfitsio-version.c) at build time. The
 executable the cfitsio-version.h file containing the definition of the
 macro COMPILED_CFITSIO_VERSION, which is a float number, that is
 used in cfitsio-module.c at run time.
Author: Rafael Laboissière <rafael@xxxxxxxxxx>
Bug-Debian: https://bugs.debian.org/994673
Forwarded: no
Last-Update: 2021-09-26

--- slcfitsio-0.3.8+nosvn.orig/src/Makefile.in
+++ slcfitsio-0.3.8+nosvn/src/Makefile.in
@@ -62,8 +62,12 @@ all: $(MODULES)
 #---------------------------------------------------------------------------
 # Put Rules to create the modules here
 #---------------------------------------------------------------------------
-cfitsio-module.so: cfitsio-module.c
+cfitsio-module.so: cfitsio-module.c cfitsio-version.h
 	$(CC_SHARED) $(INCS) cfitsio-module.c -o cfitsio-module.so $(LIBS)
+
+cfitsio-version.h: cfitsio-version.c
+	$(CC) $(INCS) cfitsio-version.c -o cfitsio-version $(LIBS)
+	./cfitsio-version > cfitsio-version.h
 #---------------------------------------------------------------------------
 # Regression tests
 #---------------------------------------------------------------------------
@@ -117,6 +117,6 @@ install_hlpfiles:
 install: all install_directories install_modules install_slfiles install_hlpfiles
 
 clean:
-	-/bin/rm -f $(MODULES) *~ \#*
+	-/bin/rm -f $(MODULES) cfitsio-version cfitsio-version.h *~ \#*
 distclean: clean
 	-/bin/rm -f config.h Makefile $(MODULES) *.fit
--- slcfitsio-0.3.8+nosvn.orig/src/cfitsio-module.c
+++ slcfitsio-0.3.8+nosvn/src/cfitsio-module.c
@@ -9,6 +9,8 @@
 
 #include <fitsio.h>
 
+#include "cfitsio-version.h"
+
 #ifdef __cplusplus
 extern "C" 
 {
@@ -2417,10 +2419,8 @@ static int check_version (void)
    float linked_version = 0;
    float tol = 0.0001;
 
-#ifdef CFITSIO_VERSION
-   compiled_version = CFITSIO_VERSION;
+   compiled_version = COMPILED_CFITSIO_VERSION;
    (void) fits_get_version (&linked_version);
-#endif
    
    if (fabs (linked_version - compiled_version) <= tol)
      return 0;
--- /dev/null
+++ slcfitsio-0.3.8+nosvn/src/cfitsio-version.c
@@ -0,0 +1,7 @@
+#include <fitsio.h>
+int main () 
+{
+     float v;
+     fits_get_version (&v);
+     printf ("#define COMPILED_CFITSIO_VERSION %f\n", v);
+}

[2021 date index] [2021 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]