I have the same error. I installed OpenSSL at /usr/local. Run config as
./configure --with-openssl=/usr/local --with-openssl-rpath=/usr/local/lib64 --enable-optimizations
output is:
checking for include/openssl/ssl.h in /usr/local... yes
checking for --with-openssl-rpath... /usr/local/lib64
checking whether OpenSSL provides required ssl module APIs... yes
checking for --with-ssl-default-suites... python
checking for stdlib extension module _ssl... yes
But make returns errors:
[ERROR] _ssl failed to import: /linx/src/Python-3.13.0/build/lib.linux-x86_64-3.13/_ssl.cpython-313-x86_64-linux-gnu.so: undefined symbol: SSL_SESSION_get_time_ex Following modules built successfully but were removed because they could not be imported: _ssl
those lib files in /usr/local/lib64 are:
drwxr-xr-x 3 root root 4096 Jan 1 18:09 cmake
drwxr-xr-x 2 root root 4096 Jan 1 21:46 engines-3
-rw-r--r-- 1 root root 10746638 Jan 1 21:46 libcrypto.a
lrwxrwxrwx 1 root root 14 Jan 1 21:46 libcrypto.so -> libcrypto.so.3
-rwxr-xr-x 1 root root 6278488 Jan 1 21:46 libcrypto.so.3
-rw-r--r-- 1 root root 1999166 Jan 1 21:46 libssl.a
lrwxrwxrwx 1 root root 11 Jan 1 21:46 libssl.so -> libssl.so.3
-rwxr-xr-x 1 root root 1221320 Jan 1 21:46 libssl.so.3
drwxr-xr-x 2 root root 4096 Jan 1 21:46 ossl-modules
drwxr-xr-x 2 root root 4096 Jan 1 18:09 pkgconfig
.bashrc:
export PATH=~/bin:/snap/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
export OPENSSL_LIBS=/usr/local/lib64/libssl.so
The OS is debian 10