Skip to content

Build wheels using manylinux

Federico Bruni edited this page Jul 22, 2019 · 1 revision

References:

Pull the manylinux2010_x86_64 image and start a new container:

podman pull quay.io/pypa/manylinux2010_x86_64
podman run --name manylinux2010 -it IMAGE_ID bash

Replace IMAGE_ID with the actual ID shown by podman images command.

After quitting the container, you can enter it with this command:

podman start -l

Let's see what we need to change to make it ready to build python-poppler-qt5.

TODO: Eventually I'll have to write a Dockerfile to build a new manylinux2010 image ready to build python-poppler-qt5, as in this project: https://github.com/apache/arrow/tree/master/python/manylinux2010

manylinux2010 runs CentOS 6, which has only Qt3 and Qt4 wrappers for poppler. We'll have to build poppler from source to have the Qt5 wrappers.

Let's install the system packages we'll need later:

yum install -y wget xz

poppler requires Cmake version 3.1.0 since version 0.53. As CentOS has Cmake version 2.8, we'll have to build poppler 0.52(february 2017):

wget https://poppler.freedesktop.org/poppler-0.52.0.tar.xz
unxz poppler-0.52.0.tar.xz
tar -xf poppler-0.52.0.tar
cd poppler-0.52.0
yum install -y fontconfig-devel libjpeg-turbo-devel openjpeg2-devel qt5-qtbase qt5-qtbase-devel
./configure --enable-poppler-qt5
make
make install

CentOS comes with Qt version 5.6.1:

# qmake-qt5 --version
QMake version 3.0
Using Qt version 5.6.1 in /usr/lib64

Add qmake to your PATH by adding this line in /root/.bashrc:

export PATH=/usr/lib64/qt5/bin/:"${PATH}"

Reload the file and check the PATH is correct:

source /root/.bashrc
echo $PATH
qmake --version

Let's download SIP 4:

wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.8/sip-4.19.8.tar.gz
tar zxvf sip-4.19.8.tar.gz
cd sip-4.19.8

SIP should be installed for each python3 version included in the container. Which versions of python3 we can use? We should use at least python3.5, as PyQt5 wheels are available for 3.5 and following versions.

Here's an example for python3.5:

/opt/python/cp35-cp35m/bin/python configure.py
make
make install

The built files will be installed within /opt/python/cp35-cp35m/.

Let's install the pip dependencies:

/opt/python/cp35-cp35m/bin/pip install auditwheel
/opt/python/cp35-cp35m/bin/pip install PyQt5

NOTE: Latest versions of PyQt5 have wheels which require glibc version higher than 2.12, as they are compiled in Red Hat 7.

You can check it with:

ldd /opt/python/cp35-cp35m/lib/python3.5/site-packages/PyQt5/QtCore.so

While the container has 2.12:

# ls -l /lib64/libc.so.6
lrwxrwxrwx. 1 root root 12 Jul 17 04:42 /lib64/libc.so.6 -> libc-2.12.so

# /lib64/libc.so.6 | grep version
GNU C Library stable release version 2.12, by Roland McGrath et al.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-23).
	The C stubs add-on version 2.1.2.
	crypt add-on version 2.1 by Michael Glad and others

...TO BE COMPLETED...

It's now time to build the wheel:

git clone https://github.com/frescobaldi/python-poppler-qt5.git
cd python-poppler-qt5
/opt/python/cp35-cp35m/bin/python setup.py bdist_wheel
Clone this wiki locally