This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: setup openssl failed on linux
Type: compile error Stage: resolved
Components: SSL Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Battant, DevinCharles, alex, christian.heimes, dstufft, janssen
Priority: normal Keywords:

Created on 2021-06-05 19:40 by Battant, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (6)
msg395180 - (view) Author: Battant (Battant) Date: 2021-06-05 19:40
Hello,
Here is my configuration


command for ubuntu distributions

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

linux kernel version
uname -r
5.4.0-74-generic


Step to reproduce

1. compile openssl 1.1.1

https://stackoverflow.com/questions/53543477/building-python-3-7-1-ssl-module-failed


clone cpython on main branch
https://github.com/python/cpython



comple python
go to module directory

run python3.11 setup.py install

Actuel result : 

I get this error : 

Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer

running build_scripts
error: file '/usr/local/lib/python3.11/config-3.11-x86_64-linux-gnu/Tools/scripts/pydoc3' does not exist

Expend result :

python3.11 modules could be installed

Could you help me to fix this issus

Best regards

Battant
msg404616 - (view) Author: Devin Prescott (DevinCharles) Date: 2021-10-21 16:44
I'm having the same issue trying to build python3.10 on CentOS 7.9

==================================================================
==================================================================
$ lsb_release -a
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core

$ scl --list
devtoolset-8

$ gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -r | cut -d"-" -f1
5.4.72
==================================================================
==================================================================

I've built and installed openssl 3.0.0 in the default location.

==================================================================
==================================================================

$ which openssl
/usr/bin/openssl

$ whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/include/openssl /usr/share/man/man1/openssl.1ossl

==================================================================
==================================================================

Attempting the fix listed in https://bugs.python.org/issue45371 I still am met with the same issue:

$ ./configure --enable-optimizations --with-lto --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions --with-openssl=/usr/lib64/openssl --with-openssl-rpath=auto

$ make -j40

...

Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer

==================================================================
==================================================================

Should I be using a path other than /usr/lib64/openssl?
msg404626 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-21 17:30
I need more information to assist you. Could you please provide:

- the steps how you compiled and install your custom OpenSSL installation
- the output of "ls /usr/lib64/openssl"
- your config.log file (please upload)
- the output of "make -j1" for the steps "building '_ssl' extension" and "building '_hashlib' extension"
msg404964 - (view) Author: Devin Prescott (DevinCharles) Date: 2021-10-25 14:07
This docker file will get you the same environment:

## Build Command ##
#    docker build --rm -t centos7/builder .
## Run Command ##
#    docker run --rm -it centos7/builder
# INSIDE DOCKER:
#    make -j $(nproc)

FROM centos:7

###################################
##   Update & Get Dependencies   ##
###################################

RUN yum -y update

RUN yum -y install deltarpm epel-release
RUN yum -y groups install Development\ Tools
RUN yum -y install libtemplate-perl wget make gcc perl-core pcre-devel zlib-devel
RUN yum -y install libffi-devel bzip2-devel pkgconfig
RUN yum install -y openssl11 openssl11-devel openssl11-libs openssl11-static
RUN mkdir -p /home/builder
WORKDIR /home/builder

###################################
##    Enable SCL Dev Toolset8    ##
###################################
RUN yum -y install centos-release-scl
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum -y install devtoolset-8
RUN scl enable devtoolset-8 bash

###################################
##    Prep Build for Python-3    ##
###################################
RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
RUN tar xzf Python-3.10.0.tgz
WORKDIR Python-3.10.0

RUN /home/builder/Python-3.10.0/configure --enable-optimizations --with-lto --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions --with-openssl=/usr/lib64/openssl11 --with-openssl-rpath=auto
msg405738 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-04 17:12
/usr/lib64/openssl11 is not a valid OpenSSL root directory. The option expects an OpenSSL installation directory with bin, lib, and include subdirectories. The custom scheme from CentOS EPEL openssl11 package is not supported.
msg406112 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-10 16:55
Update:

I came up with a hack that lets you use the openssl11 module from EPEL with Python:

https://discuss.python.org/t/modulenotfounderror-no-module-named-mysql-in-python-3-10-0-default-nov-6-2021-1425-gcc-4-8-5-20150623-red-hat-4-8-5-44-on-linux/11823/5?u=tiran

sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88485
2021-11-10 16:55:11christian.heimessetmessages: + msg406112
2021-11-04 17:12:31christian.heimessetstatus: open -> closed
resolution: not a bug
messages: + msg405738

stage: resolved
2021-10-25 14:07:16DevinCharlessetmessages: + msg404964
title: setup openssl faild on linux (ubuntu 20.04) -> setup openssl failed on linux
2021-10-21 17:30:00christian.heimessetmessages: + msg404626
2021-10-21 16:44:49DevinCharlessetversions: + Python 3.10
nosy: + janssen, christian.heimes, alex, dstufft, DevinCharles

messages: + msg404616

type: compile error
2021-06-05 21:01:31christian.heimessetassignee: christian.heimes ->

nosy: - christian.heimes
2021-06-05 19:40:30Battantcreate