Building universal (fat) OS X binaries with numpy distutils

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Building universal (fat) OS X binaries with numpy distutils

Zachary Pincus-2
Hello all,

I'm wondering if anyone could let me know what the current "best  
practices" are for building universal python extensions on OS X with  
numpy's distutils and fortran code.

Currently, I've been doing what this message suggests:
http://mail.python.org/pipermail/pythonmac-sig/2007-June/018986.html

That is, get gfortran from http://r.research.att.com/tools/ , copy  
libgfortran.a to somewhere different like ~/staticlibs/, and then do  
this to build:

export LDFLAGS="-undefined dynamic_lookup -bundle -arch i386 -arch ppc
-Wl,-search_paths_first"

python setup.py config_fc --fcompiler=gnu95 --arch="-arch i386 -arch  
ppc"
build_ext -L ~/staticlibs/ build

Is this still the best bet? Also, how best should one get python  
itself to compile as universal? (For py2app purposes...)

Thanks,
Zach
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Building universal (fat) OS X binaries with numpy distutils

Robert Kern-2
On Mon, May 26, 2008 at 1:35 PM, Zachary Pincus <[hidden email]> wrote:

> Hello all,
>
> I'm wondering if anyone could let me know what the current "best
> practices" are for building universal python extensions on OS X with
> numpy's distutils and fortran code.
>
> Currently, I've been doing what this message suggests:
> http://mail.python.org/pipermail/pythonmac-sig/2007-June/018986.html
>
> That is, get gfortran from http://r.research.att.com/tools/ , copy
> libgfortran.a to somewhere different like ~/staticlibs/, and then do
> this to build:
>
> export LDFLAGS="-undefined dynamic_lookup -bundle -arch i386 -arch ppc
> -Wl,-search_paths_first"
>
> python setup.py config_fc --fcompiler=gnu95 --arch="-arch i386 -arch
> ppc"
> build_ext -L ~/staticlibs/ build
>
> Is this still the best bet?

Yes. Have you had any problems with it?

> Also, how best should one get python
> itself to compile as universal? (For py2app purposes...)

Just us the binary from www.python.org. Is this not possible for your use case?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Building universal (fat) OS X binaries with numpy distutils

Zachary Pincus-2
> On Mon, May 26, 2008 at 1:35 PM, Zachary Pincus <[hidden email]
> > wrote:
>> Hello all,
>>
>> I'm wondering if anyone could let me know what the current "best
>> practices" are for building universal python extensions on OS X with
>> numpy's distutils and fortran code.
>>
>> Currently, I've been doing what this message suggests:
>> http://mail.python.org/pipermail/pythonmac-sig/2007-June/018986.html
>>
>> That is, get gfortran from http://r.research.att.com/tools/ , copy
>> libgfortran.a to somewhere different like ~/staticlibs/, and then do
>> this to build:
>>
>> export LDFLAGS="-undefined dynamic_lookup -bundle -arch i386 -arch  
>> ppc
>> -Wl,-search_paths_first"
>>
>> python setup.py config_fc --fcompiler=gnu95 --arch="-arch i386 -arch
>> ppc"
>> build_ext -L ~/staticlibs/ build
>>
>> Is this still the best bet?
>
> Yes. Have you had any problems with it?

No problems, but I just wanted to make sure that there wasn't now a  
simpler way already rolled in to the distutils or something, and to  
also make sure that there weren't some previously-discovered subtle  
problems with that method.

>> Also, how best should one get python
>> itself to compile as universal? (For py2app purposes...)
>
> Just us the binary from www.python.org. Is this not possible for  
> your use case?

I can, but I often build Python myself and I was just wondering how  
one does it. I can check elsewhere about this, though -- it's a bit  
off-topic for this list, I guess.

Thanks,
Zach
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Building universal (fat) OS X binaries with numpy distutils

Robert Kern-2
On Mon, May 26, 2008 at 6:39 PM, Zachary Pincus <[hidden email]> wrote:
> [Robert Kern wrote:]
>> On Mon, May 26, 2008 at 1:35 PM, Zachary Pincus <[hidden email]

>>> Also, how best should one get python
>>> itself to compile as universal? (For py2app purposes...)
>>
>> Just us the binary from www.python.org. Is this not possible for
>> your use case?
>
> I can, but I often build Python myself and I was just wondering how
> one does it. I can check elsewhere about this, though -- it's a bit
> off-topic for this list, I guess.

It's easiest to use the script Mac/BuildScript/build-installer.py. I
had to make a few modifications to the copy in the Python-2.5.2
tarball to update the URLs of the dependencies and such, but I expect
the one from SVN trunk should be up to date.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Building universal (fat) OS X binaries with numpy distutils

Zachary Pincus-2
> It's easiest to use the script Mac/BuildScript/build-installer.py. I
> had to make a few modifications to the copy in the Python-2.5.2
> tarball to update the URLs of the dependencies and such, but I expect
> the one from SVN trunk should be up to date.


Thanks for the pointer!

I really appreciate the helpfulness of all of the denizens of this  
list on issues large and small, and especially Robert. Thanks again.

Zach
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion