[Python-Dev] dynamic linking, libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and Mac OS X
Chris Withers
chris at withers.org
Thu Dec 24 06:17:33 EST 2015
Hi All,
I hit this every time I install packages on Mac OS X that use libssl, it
looks like extensions are built linking to .dylib's that are not
resolveable when the library is actually used:
>>> from OpenSSL import SSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File
"python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py",
line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError:
dlopen(python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so,
2): Library not loaded: libssl.1.0.0.dylib
Referenced from:
python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so
Reason: image not found
Looking at what this links to, I see:
$ otool -L
lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so
lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so:
libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
Whereas the functional _ssl that ships with Python distributions on Mac
OS X look like this:
$ otool -L .../lib/python2.7/lib-dynload/_ssl.so
.../lib/python2.7/lib-dynload/_ssl.so:
@loader_path/../../libssl.1.0.0.dylib (compatibility version 1.0.0,
current version 1.0.0)
What's going wrong here and what can be done differently to have
'pip install package_using_libssl' build a usable binary installation?
Here's a couple of examples of this problem in the wild:
https://github.com/alekstorm/backports.ssl/issues/9
http://stackoverflow.com/questions/32978365/how-do-i-run-psycopg2-on-el-capitan-without-hitting-a-libssl-error
https://github.com/psycopg/psycopg2/issues/385
I'm well out of my depth here, I just want to use these libraries, but
I'm happy to try and do the work to make the world a better place for
Mac users of these libraries...
Chris
More information about the Python-Dev
mailing list