build.env-append working with merger in muniversal?

Michael Dickens michaelld at macports.org
Tue Sep 14 10:57:37 PDT 2010


On Sep 14, 2010, at 10:38 AM, Michael Dickens wrote:
> I'll post a follow-up later today (hopefully this morning in US/ET), since I've figured out a way to get this port to build +universal now, which I think is reasonably backwards-compatible yet reasonably generic.

First follow up; another with file diffs later once I've done more testing.

It is possible to create "universal" Python libraries such as what NumPy provides, and they work just fine.  Just -make sure- to not link with -lpython in any library that Python imports, since that causes Python to die ungracefully.  What I wrote before is correct, in my experimentation (i.e., install as universal then use 'lipo' to remove a specific architecture & see if the import works): Importing modules in Python works so long as the bittage of all necessary installed compiled libraries match up with what Python expects.  For example, my install expects x86_64, and if I remove that arch from even a single library, when I do the "import numpy" the error is (e.g.):

+++++++++++++++
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/linalg/lapack_lite.so, 2): no suitable image found.  Did find:
        /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/linalg/lapack_lite.so: no matching architecture in universal wrapper
+++++++++++++++

That said, I haven't figured out how to execute Python as 32-bit to test whether or not that variety works (meaning: importing as just 32-bit, since I don't think OSX allows a single process to load both 32 and 64-bit libraries).  From what I read, I'm supposed to be able to do:

VERSIONER_PYTHON_PREFER_32_BIT=yes python

and then whatever executable 'python' points to will be loaded as 32-bit if that version is available.  My Python26 install from MacPorts is universal, but it won't load as 32-bit; nor will Apple's "provided in OSX" one.  Has anyone succeeded in doing this?

One can (supposedly) test out the bittage of Python running via:

import struct
struct.calcsize("P")

(the size of a pointer), which always returns 8 for me.  More later. - MLD


More information about the macports-dev mailing list