[Numpy-discussion] Solaris Sparc build broken

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri Nov 6 00:35:50 EST 2009


Charles R Harris wrote:
> So you are going to leave us all hanging here in curiosity? What is
> your solution?

I had to sleep :)

The solution is based on parsing the generated binary code - that's how
MPFR is doing it, so it has been tested in the wild. The code to compile
is something like:

/* "before" is 16 bytes to ensure there's no padding between it and "x".
 *    We're not expecting any "long double" bigger than 16 bytes or with
 *       alignment requirements stricter than 16 bytes.  */
typedef long double test_type;

struct {
        char         before[16];
        test_type    x;
        char         after[8];
} foo = {
        { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
          '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
        -123456789.0,
        { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
};

They compile it, parse with awk from the dump od -f.

I have the python code to replace the awk script and of -f, and added
support for Intel quad precision (Intel compiler can generate it). The
only problems is universal build. I don't think the latter has any
solution which is not runtime based, so we will have to special case for
it, as we did for endianess detection.

I have tested it with sparc64, sparc32, ppc, amd64 cross compilers, work
on all of them (but that only include linux OS).

David



More information about the NumPy-Discussion mailing list