#74 Problems of endianness detection.

open
None
5
2010-05-26
2010-05-21
No

Dear James,

When trying to build Lincoln Stein's Bio::SCF Perl module, which depends on the Staden libread, problems of endiannes detection happen on some architectures. You can see the in the build logs at the following page: https://buildd.debian.org/pkg.cgi?pkg=libbio-scf-perl

The following patch was sent in the Debian Bug tracking system and should solve the problem. Do you think you can release a new upstream version that includes it ?

Have a nice week-end,

--
Charles

Discussion

  • Charles Plessy

    Charles Plessy - 2010-05-21

    Corrects detection of endianness.

     
  • James Bonfield

    James Bonfield - 2010-05-26
    • assigned_to: nobody --> jkbonfield
     
  • James Bonfield

    James Bonfield - 2010-05-26

    It needs an overhaul for sure, but the patch doesn't solve it universally unfortunately - just for debian systems. Certainly in the past (and it's a bit hard for me to test now) not all operating systems we've built the code on have an endian.h, and even those that do do not have the same symbol names to indicate endianness. This is why autoconf has a means for detecting this, which *in theory* I use. In practice I guess it's broken. My apologies for that, although it's tricky to test. I'll have a play with qemu to try and get a different endian system to verify changes with.

    Note that this code was also rather tricky to get right so that it builds as "fat binaries" on MacOS - just checking a header doesn't solve that IIRC, it needs tests at compile time. I went through a round of changes with someone else crafting it so that fat binaries worked correctly. Alas I can't regression test any subsequent changes again due to not having the hardware (nor the software as macos can't be installed under emulation, even if I did have a licenced copy).

    I suspect the easy solution is just to put all the machine auto-detection nonsense into a #else clause so that it only gets used when HAVE_CONFIG_H is not defined. I'll have an experiment.

     
  • James Bonfield

    James Bonfield - 2010-05-26

    I've made a start on this now (see SVN). Basically the entire issue can be subverted by using an os.h.in file to generate a precomputed os.h with the endianness already in it. This means tools that #include parts of staden_read don't need autoconf or config.h in order to work. The situation is still muddied by MacOS X FAT binaries, but I believe I have a working solution.

    I still need to go through removing the include of the config.h file though. This should be in the .c files and not the .h file - it's next on the to-do list.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks