[Numpy-discussion] numpy distutils breaks scipy install on mac

Mark Sienkiewicz sienkiew@stsci....
Wed Dec 9 14:03:07 CST 2009


Robert Kern wrote:
> On Tue, Dec 8, 2009 at 15:36, Mark Sienkiewicz <sienkiew@stsci.edu> wrote:
>   
>>
>> ( Presumably, some other version of gfortan does accept -arch, or this
>> code wouldn't be here, right? )
>>     
>
> Right. The -arch flag was added by Apple to GCC and their patch really
> should be applied to all builds of GCC compilers for the Mac. It is
> deeply disappointing that Fink ignored this.

So, you're saying that an un-patched GCC doesn't know -arch ?  In that 
case, isn't it a mistake to see "gfortran" on the path, and then assume 
that you can say "-arch" to it?

> The only Mac gfortran
> build that I can recommend is here:
>
>   http://r.research.att.com/tools/
>   

I saw the "should" note about that in the installation instructions.  If 
I were doing this for personal use, I would have just installed that 
compiler and been done with it.  Unfortunately, I am supporting many 
users who are already going to have the fink gfortran installed, and 
therefore I have to build scipy to use those libraries.  It would be a 
tremendous amount of work just to convince my IT department to uninstall 
the fink gfortran and install the AT&T gfortran on every mac at the 
institute.

> _can_target() should be fixed to be more accurate, though, so if you
> find a patch that works for you, please let us know.
>   

Here is an idea:

I have a Mac Tiger machine that I believe has the AT&T gfortran 
installed.  It can make universal binaries.  It says:

% gfortran -arch bananapc6000 -v
gfortran: Invalid arch name : bananapc6000
%

But the Mac Leopard machine with the Fink:

% gfortran -arch bananapc6000 -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.3.0/configure --prefix=/sw 
--prefix=/sw/lib/gcc4.3 --mandir=/sw/share/man --infodir=/sw/share/info 
--enable-languages=c,c++,fortran,objc,java --with-arch=nocona 
--with-tune=generic --build=i686-apple-darwin9 --with-gmp=/sw 
--with-libiconv-prefix=/sw --with-system-zlib 
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib 
--disable-libjava-multilib
Thread model: posix
gcc version 4.3.0 (GCC)
%

So, if you ask gfortran to use an obviously bogus architecture and it 
objects with the message "Invalid arch name", then it knows what -arch 
means.  If it says anything else, then it doesn't.  It should work until 
somebody ports gfortran to make bananapc6000 binaries. :)

I think this is an ugly hack, but that's how it is when you use 
auto-detection.  (I wish there were some way that distutils could 
autodetect everything, write it into a file, let me edit that file, then 
next time I run setup.py it would use the values in the file, but I 
expect that would require a near complete re-write of distutils, and I 
just don't have time.)

Mark



More information about the NumPy-Discussion mailing list