1

I need to build a redistributable, self-contained Python environment using pyenv on macOS.

The problem I'm running into is that there are dependencies on dynamic libraries. These dependencies include the full path of the dynamic library (e.g., libssl.1.0.0.dylib under /usr/local/opt/). For example, one of the dependencies of the Python ssl module is lib-dynload/_ssl.cpython-37m-darwin.so which references the system libssl.

I cannot redistribute this because users don't always have openssl in the same directory as my build machine. I cannot control the location where users will install my bundle because it will be in their home directory. So absolute paths are right now.

I considered using rpath, which lets dynamic libraries specify their dependencies with relative paths. That appears to have security issues, so I'd prefer not to use it.

Is it possible to configure pyenv to use static libraries when possible, such as for openssl?

George
  • 4,189
  • 2
  • 24
  • 23
  • Have you seen https://stackoverflow.com/questions/48796014/compile-python-code-to-statically-linked-executable-with-cython? – Matthias Winkelmann Oct 13 '19 at 19:44
  • @MattW. If I were compiling just Python it would be easier because I'd have direct control over the command line. I need to use pyenv for backward compatibility, so my question is specifically about configuring or tricking pyenv into doing this. Also, you can't build static binaries on macOS. – George Oct 14 '19 at 05:00

0 Answers0