-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
bpo-38794: setup: support linking openssl statically #17153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The travis build is failing because autoreconf has not run. See output line 1319: After autoreconf OPENSSL_STATIC_ROOT would be defined as "" and then ssl extension would be compiled just like before this change. |
|
Thanks for the PR @luv! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run autoreconf... don't worry, it's part of the workflow for PRs like these.
This should also have a NEWS entry. It can just be something like:
Support linking OpenSSL statically with a new ``--with-openssl-static`` configure option.- adding generated files aclocal.m4 and configure - adding NEWS blurb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
CC @tiran |
|
Has anyone looked at just using |
|
@ned-deily Sounds good and if that option is easily discoverable it solves the problem just as well. However I am not putting in the effort to reimplement this using Anyway, you need to find someone else to do that work now. |
|
Static linking for ssl and hashlib module has been proposed multiple times. Python will not have official support for static linking of OpenSSL. There are just too many ways it can go wrong and I lack both interest and time to support the feature. For example this implementation will likely break 3rd party extension with symbol conflicts. You can either use |
Currently, it's easy to compile CPython even on old distributions like RHEL5, RHEL6, Ubuntu14.04 etc. except for ssl module.
This PR adds a new ./configure option --with-openssl-static which makes it easy to compile statically against OpenSSL so CPython with ssl module can be easily compiled on systems with OpenSSL <1.0.2 (you usually don't want to install newer openssl as system libary nor mess with rpath/set LD_LIBRARY_PATH every time you run python).
With this change, if --with-openssl-static is not set everything behaves like before.
When/if this PR is merged, autoreconf needs to be run to regenerate bundled ./configure script etc.. I am not sure what's the recommended process to run autoreconf (version, parameters, ...) so I have not comitted the generated files.
Installing CPython including ssl on system as old as RHEL5 with this option only takes (after installing required build dependencies from rhel5 repositories and installing libffi(-devel) rpm):
wget https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar xf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./config --openssldir=/etc/pki/tls -fPIC
make
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar xf Python-3.7.5.tgz
cd Python-3.7.5
./configure --with-openssl-static=path_to_just_compiled_ssl --prefix=prefix_path
make
make install
https://bugs.python.org/issue38794