On some 64-bit platforms, which include, but is not limited to:

 * Some version of OS X (I don't know what versions or processors)
 * Solaris on SPARC processors.
 * Solaris on x86 processors.
 * OpenSolaris on SPARC processors.
 * OpenSolaris on x86 processors.
 * HP-UX on PA-RISC processors.

the default is to build 32-bit objects, but 64-bit objects can be created if needed. This is usually done via adding the -m64 flag when compiling with GCC or SunStudio, though the flag will be different with HP's compiler.

Numpy is used as part of Sage, but it would appear that adding -m64 to CFLAGS will not work. A comment in the script used to build numpy shows:

# numpy's distutils is buggy and runs a conftest without
# taking CFLAGS into account. With 64 bit OSX this results
# in *boom*

it then goes on to copy a file called gcc_fake, which is basically a script which gets renamed to gcc, but includes the -m64 flag.

We are using numpy-1.3.0.

Is this a known bug? If not, can I submit it to a bug database? Better still, does anyone have a patch to resolve it - I hate the idea of making

I've now changed the build method in Sage so it does not only work on OS X, and does not hard-code the path to gcc. I have:

if [ "x$SAGE64" = xyes ]; then
   echo "Building a 64-bit version of numpy"
   # HACK ALERT
   # HACK ALERT
   # HACK ALERT
   echo "HACK ALERT - HACK ALERT - HACK ALERT"
   echo "HACK ALERT - HACK ALERT - HACK ALERT"
   echo "HACK ALERT - HACK ALERT - HACK ALERT"
   echo "Creating a sort of fake gcc, which has the -m64 flag"
   echo "#!/usr/bin/env bash" > $SAGE_LOCAL/bin/gcc
   echo "`command -v gcc` -m64 \$@" >> $SAGE_LOCAL/bin/gcc
   chmod 755 $SAGE_LOCAL/bin/gcc
fi

This this file $SAGE_LOCAL/bin/gcc is used to build just numpy. After that, we can remove it

if [ "x$SAGE64" = xyes ]; then
   echo "deleting fake gcc"
   rm $SAGE_LOCAL/bin/gcc
fi

and let the normal gcc program be used with an appropriate setting of CFLAGS to make other packages build 64-bit.

I know this issue has been known in Sage for a long time (years) but I don't know if it was ever reported to the Numpy mailing list or added to any bug database

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to