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

Discussion in 'Python' started by Paul Smith, Nov 13, 2013.

  1. Paul Smith

    Paul Smith Guest

    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.
    Paul Smith, Nov 13, 2013
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ned Deily
    Replies:
    0
    Views:
    129
    Ned Deily
    Nov 13, 2013
  2. Ned Deily
    Replies:
    0
    Views:
    72
    Ned Deily
    Nov 13, 2013
  3. Ned Deily
    Replies:
    0
    Views:
    102
    Ned Deily
    Nov 14, 2013
  4. Paul Smith
    Replies:
    0
    Views:
    79
    Paul Smith
    Nov 13, 2013
  5. Ned Deily
    Replies:
    0
    Views:
    83
    Ned Deily
    Nov 14, 2013
Loading...

Share This Page