[clug] Building Python3.7 RPM on CentOS 7

Luke Mewburn lukem-clug at mewburn.net
Thu May 30 07:03:56 UTC 2019


On 19-05-30 16:22, jm via linux wrote:
  | 
  | Anyone have any directions for creating a rpm of python 3.7 on CentOS
  | 7?  I'm trying the steps detailed below and running to problems,


If python 3.6 (vs 3.7) was acceptable, you could use python 3.6
provided by one of the following CentOS 7 packages:

- rh-python36 from EPEL repo
	- Enable repo via package epel-release from extras

- python36 from SCL repo
	- Enable repo via package centos-release-scl-rh from extras


Otherwise, have you tried grabbing the python 3.6 source RPM from
EPEL or CentOS SCL and seeing how that specfile works?


I often find that is a handy way to work out how to setup
my own RPM build of a similar version, especially in a
backport/forwardport scenario.


  | 
  | Download
  | ---------
  | $ curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
  | 
  | Extract
  | ------
  | $ xz -d Python-3.7.3.tar.xz
  | $ tar xvf Python-3.7.3.tar
  | $ cd Python-3.7.3
  | 
  | $ ./configure --enable-optimizations --with-lto 
  | --prefix=/usr/local/python37/ CXX="/usr/bin/g++"
  | 
  | Output includes these line,
  | 
  | checking for pkg-config... /usr/bin/pkg-config
  | 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
  | 
  | Build
  | ----
  | $ make
  | $ ./python setup.py bdist_rpm
  | 
  | 
  | Local Install
  | ----------
  | as root:
  | # make altinstall
  | 
  | Create Python Virtual Environment
  | -----------------------------
  | 
  | $ /usr/local/python37/bin/python3.7 -m venv $HOME/py37
  | $ source $HOME/py37/bin/activate
  | 
  | $ which python
  | ~/py37/bin/python
  | 
  | $ python -V
  | Python 3.7.3
  | 
  | Build RPM
  | --------
  | $python setup.py bdist_rpm
  | 
  | 
  | This produces several error ending with
  | 
  | 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
  | 
  | running build_scripts
  | creating build/scripts-3.7
  | error: file
  | '/usr/local/python37/lib/python3.7/config-3.7m-x86_64-linux-gnu/Tools/scripts/pydoc3'
  | does not exist
  | error: Bad exit status from /var/tmp/rpm-tmp.uJBjOh (%build)
  | 
  | 
  | RPM build errors:
  |     Bad exit status from /var/tmp/rpm-tmp.uJBjOh (%build)
  | error: command 'rpmbuild' failed with exit status 1
  | 
  | 
  | Thoughts?
  | 
  | Jeff.


Luke.



More information about the linux mailing list