Search code examples
pythonubuntucrashopensslkomodo

Komodo IDE 7 crashes on Ubuntu 11.10


Starting Komodo IDE 7 on Ubuntu 11.10 crashes in libcrypto.so during startup (see this forum discussion):

#0  0xb121ffbc in EVP_PKEY_CTX_dup () from /lib/i386-linux-gnu/libcrypto.so.1.0.0
#1  0xb12121f6 in EVP_MD_CTX_copy_ex () from /lib/i386-linux-gnu/libcrypto.so.1.0.0
#2  0xb1212362 in EVP_MD_CTX_copy () from /lib/i386-linux-gnu/libcrypto.so.1.0.0
#3  0xb0e93c4d in ?? () from .../Komodo-IDE-7/lib/python/lib/python2.6/lib-dynload/_hashlib.so
#4  0xb0e93fc9 in ?? () from .../Komodo-IDE-7/lib/python/lib/python2.6/lib-dynload/_hashlib.so
#5  0xb549ba2d in PyCFunction_Call () from .../Komodo-IDE-7/lib/mozilla/libpython2.6.so

How can I get it to run successfully?


Solution

  • On investigation, this happens when calling a function in the _hashlib module. This module is a builtin module in the standard Ubuntu python install (see sys.builtin_module_names), so the _hashlib.so that exists under lib/python/lib/python2.6/lib-dynload/_hashlib.so is not part of the Ubuntu python build.

    You can fix this by recompiling that module from the standard Python sources:

    export KOMODO_DIR=/home/davidf/Applications/Komodo-IDE-7
    hg clone http://hg.python.org/cpython
    cd cpython
    hg checkout v2.6.5
    (
        cd $KOMODO_DIR/lib/python/lib
        # handle no libssl.so
        ln -s /lib/libssl.so.0.9.8
        ln -s ./libssl.so.0.9.8 libssl.so
        # save the original _hashlib library
        cd python2.6/lib-dynload/
        mv _hashlib.so _hashlib.so.orig
    )
    # cd to python src for python 2.6.5
    ./configure --prefix $KOMODO_DIR/lib/python/
    
    # step here to patch setup.py as @jalefkowit describes
    # ...
    
    # build and copy result to komodo's lib-dynload directory
    $KOMODO_DIR/lib/python/bin/python setup.py build_ext
    cp build/lib.linux-i686-2.6/_hashlib.so $KOMODO_DIR/lib/python/lib/python2.6/lib-dynload/
    

    Caveats:

    • I didn't actually use the above script; it's a recreation. There may be mistakes :)
    • You need the CPython 2.6.5 sources; you can get these some other way if you like
    • There is probably a shorter, and simpler way to do this
    • This will build all the Python extension modules, not just the one you need
    • On my Ubuntu 11.10, there's a libssl.so.0.9.8, but no libssl.so. The above linking allows the Python build to find them.
    • This actually works on my machine, but for 64-bit / another release, you may need some adjustments