Wednesday, February 13, 2019

Python configure on Debian: compiling and linking against OpenSSL doesn't work

If you are running ./configure on a new download of Python and you get this:

checking whether compiling and linking against OpenSSL works... no

And you already have openssl installed...

Make test after a build returns:

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

just do:

sudo apt-get install libssl-dev

Now when you run ./configure you should see:

checking whether compiling and linking against OpenSSL works... yes
checking for X509_VERIFY_PARAM_set1_host in libssl... yes
checking for --with-ssl-default-suites... python