[Numpy-discussion] Is numpy ignoring CFLAGS?

Dr. David Kirkby david.kirkby@onetel....
Mon Jun 28 04:56:51 CDT 2010


On 06/28/10 09:38 AM, Dag Sverre Seljebotn wrote:
> Dr. David Kirkby wrote:
>> 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:
>>
> First: Is Python built using -m64? If not, is there a reason that NumPy
> in 64 bit and load it into 32 bit Python work? If Python is built with
> -m64 I'd expect NumPy to pick it up automatically as it queries Python
> for the build flags to use...

Yes, Python is built 64-bit, using the -m64 option.

>> # 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
>>
> Until somebody who really knows an answer chimes in;
>
> AFAIK this is a "feature" in distutils itself, so it affects most Python
> software. (Setting CFLAGS overwrites the necesarry CFLAGS settings, like
> -fPIC and -fno-strict-aliasing, that is queried from Python). Try
> setting "OPT" instead?
>
> Dag Sverre

OPT has -m64 in it.

This is the bit that shows how Python is built on Solaris (uname=SunOS). SAGE64 
will be set to "yes" for a 64-bit build.

OPT="-g -O3 -m64 -Wall -Wstrict-prototypes"; export OPT
./configure $EXTRAFLAGS --prefix="$SAGE_LOCAL"  \
--enable-unicode=ucs4 --with-gcc="gcc -m64"


Many other parts of Sage seem to inherit the flags ok from Python, but not numpy.

It is not a Solaris specific issue, as the same issue results on OS X.

Dave
Dave



More information about the NumPy-Discussion mailing list