Package: libcfitsio2
Version: 2.510-1
Severity: normal
Tags: upstream patch 


The libfitsio2 library does not work on arm and mipsel.  I discovered this
from the buildd logs for the slcfitsio package:

http://buildd.debian.org/fetch.php?&pkg=slcfitsio&ver=0.3.2b-4&arch=arm&stamp=1132249413&file=log&as=raw
http://buildd.debian.org/fetch.php?&pkg=slcfitsio&ver=0.3.2b-4&arch=mipsel&stamp=1132283865&file=log&as=raw

The simple test program attached below fails on vaughan.debian.org (a
mipsel machine) with the following error message:


[EMAIL PROTECTED]:~$ ./test
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 Byteswapping is not being done correctly on this system.
 Check the MACHINE and BYTESWAPPED definitions in fitsio2.h
 Please report this problem to the author at
     [EMAIL PROTECTED]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fits_create_file returned status=1


[As this error message suggests, I am Cc:ing this bug report to the
address mentioned above.]


The following patch to the upstream source fixes the problem on vaughan:


--- fitsio2.h   2005-11-18 16:51:07.000000000 +0000
+++ fitsio2.h-new       2005-11-18 16:49:57.000000000 +0000
@@ -132,6 +132,12 @@
 #define MACHINE PC64BIT
 #define LONGSIZE 64   
 
+#elif defined(MIPSEL) || defined(arm)
+
+/* mipsel and arm architectures */
+#define BYTESWAPPED TRUE
+#define MACHINE NATIVE
+
 #else
 
 /*  assume machine uses the same IEEE formats as used in FITS files */



[Please, notice that I only tested the patch above on vaughan, a mipsel
machine. There is currently no arm machine available to Debian
developers.]


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.8-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages libcfitsio2 depends on:
ii  libc6                         2.3.5-6    GNU C Library: Shared libraries an

libcfitsio2 recommends no packages.

-- no debconf information

#include <stdio.h>
#include <unistd.h>
#include <fitsio.h>
int main ()
{
   fitsfile *f;
   char *file = "/tmp/foo.fits";
   int status = 0;

   (void) remove (file);
   fits_create_file (&f, file, &status);
   if (status)
     fprintf (stderr, "fits_create_file returned status=%d\n", status);
   if (f != NULL)
     {
        status = 0;
        fits_close_file (f, &status);
     }

   return 0;
}

Reply via email to