python 2.7.x on MacOSX: failed dlopen() on .so's

P

Paul Smith

Hi all. I need to build my own version of Python on a MacOSX system,
and I can't seem to do it successfully. I need to build it with a
particular location, etc. and so I can't use Homebrew or whatever: I
need to compile it myself from the source tarball. I did look through
the Homebrew recipe and I don't see anything that seems like it would
help with my problem.

I'm using MacOSX 10.7.5 with xcode 4.1, containing gcc 4.2.1 / clang 2.1
(configure seems to choose gcc).

I've tried this with both Python 2.7.5 and 2.7.6. I get the tarball,
unpack it, then:

$ configure --prefix=/Users/build/python
$ make
$ make install
$ export PATH=/Users/build/python/bin:$PATH
$ export PYTHONHOME=/Users/build/python
$ python2.7 --version
Python 2.7.6

Simple scripts seem to work fine. But then I need to install various
packages; for example pycrypto. When I try to build that it fails to
build:

$ cd src/pycrypto-2.6 && python2.7 setup.py build
Traceback (most recent call last):
File "setup.py", line 45, in <module>
import struct
File "/Users/build/python/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: dlopen(/Users/build/python/lib/python2.7/lib-dynload/_struct.so, 2): Symbol not found: _PyObject_Free
Referenced from: /Users/build/python/lib/python2.7/lib-dynload/_struct.so
Expected in: dynamic lookup

This happens with every module that is not pure-Python: boto, paramiko,
etc.

Looking at the various python2.7/lib-dynload/*.so files with nm I see
that actually a number of them refer to an unresolved ("U") symbol
_PyObject_Free (and other _PyObject_* symbols). I can't find any shared
library being built by the python build (.dylib or .so or whatever);
there's just a libpython2.7.a file (I tried forcing --enable-shared on
the configure line and it didn't change anything).


I should say that I've used this same configuration and set of steps,
etc. on my GNU/Linux system and it worked perfectly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top