Skip to content

Commit c3d1e5c

Browse files
authored
refactor: use the same OpenSSL for all linux architectures (#149)
Building wheels for linux requires an up-to-date OpenSSL development "package" to be present on the system. Until now, x86/x64 builds relied on the one provided by dockcross images & aarch64/ppc64le/s390x used one rebuilt by this repo in CI. For consistency's sake, use the same one for all architectures i.e. rebuilt from sources by this repo in CI. This allows OpenSSL upgrades not to be dependent on dockcross image updates & keeps a single source of truth regarding OpenSSL version in the repo.
1 parent 4730aee commit c3d1e5c

File tree

5 files changed

+72
-79
lines changed

5 files changed

+72
-79
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ references:
3131

3232
x64_build_job: &x64_build_job
3333
docker:
34-
- image: dockcross/manylinux1-x64
34+
- image: quay.io/pypa/manylinux1_x86_64:2021-05-29-46e3cf1
3535
<<: *ci_steps
3636

3737
x86_build_job: &x86_build_job
3838
docker:
39-
- image: dockcross/manylinux1-x86
39+
- image: quay.io/pypa/manylinux1_i686:2021-05-29-46e3cf1
4040
<<: *ci_steps
4141

4242
no_filters: &no_filters

scikit-ci.yml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,14 @@ before_install:
1515
commands:
1616
- python: |
1717
import ci, os
18-
image_name=os.environ["DEFAULT_DOCKCROSS_IMAGE"].split(":")[0].split("/")[1]
19-
print("image_name [%s]" % image_name)
20-
manylinux_version=image_name.split("-")[0]
21-
arch=image_name.split("-")[1]
22-
manylinux_arch = {"x86": "i686", "x64": "x86_64"}.get(arch, arch)
23-
print("arch [%s]" % arch)
24-
print("manylinux_version [%s]" % manylinux_version)
25-
print("manylinux_arch [%s]" % manylinux_arch)
26-
# Support using older manylinux images explicitly setting AUDITWHEEL_* environment variables
27-
os.environ["AUDITWHEEL_ARCH"] = manylinux_arch
28-
os.environ["AUDITWHEEL_PLAT"] = manylinux_version + "_" + manylinux_arch
18+
arch = os.environ["AUDITWHEEL_PLAT"].split("_", 1)[1]
19+
# ENTRYPOINT
20+
if arch == "i686":
21+
os.environ["ENTRYPOINT"] = "linux32"
22+
else:
23+
os.environ["ENTRYPOINT"] = "exec"
2924
# SETUP_CMAKE_ARGS
30-
if arch in ["x86", "x64"]:
31-
os.environ["SETUP_CMAKE_ARGS"] = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl " + os.environ["SETUP_CMAKE_ARGS"]
25+
os.environ["SETUP_CMAKE_ARGS"] = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl " + os.environ["SETUP_CMAKE_ARGS"]
3226
ci.driver.Driver.save_env(os.environ)
3327
3428
travis:
@@ -49,7 +43,7 @@ before_install:
4943
setup_cmake_args.append("-DSTRIP_EXECUTABLE:FILEPATH=/opt/rh/devtoolset-9/root/usr/" + "/bin/strip")
5044
if platform.machine() in {"aarch64", "ppc64le", "s390x"}:
5145
# Remove this after addressing https://github.com/dockcross/dockcross/issues/431
52-
setup_cmake_args.append("-DOPENSSL_ROOT_DIR:PATH=/tmp/openssl-install")
46+
setup_cmake_args.append("-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl")
5347
os.environ["SETUP_CMAKE_ARGS"] = " ".join(setup_cmake_args)
5448
if platform.machine() in {"ppc64le"}:
5549
# the container sees all 16 threads but building with all of them
@@ -65,6 +59,11 @@ install:
6559
- python -m pip install --disable-pip-version-check --upgrade pip
6660
- pip install -r requirements-test.txt -r requirements-repair.txt
6761

62+
circle:
63+
commands:
64+
- pipx install cmake
65+
- ${ENTRYPOINT} ./scripts/manylinux-build-and-install-openssl.sh
66+
6867
before_build:
6968
commands:
7069
- flake8
@@ -100,11 +99,7 @@ test:
10099

101100
circle:
102101
commands:
103-
- |
104-
if [[ ${AUDITWHEEL_ARCH} == "aarch64" ]]; then
105-
exit
106-
fi
107-
python setup.py test
102+
- python setup.py test
108103

109104
travis:
110105
osx:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Configure, build and install OpenSSL to support building of CMake using manylinux docker images
5+
#
6+
7+
set -eux
8+
set -o pipefail
9+
10+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
11+
source $MY_DIR/utils.sh
12+
13+
OPENSSL_ROOT=openssl-1.1.1k
14+
# Hash from https://www.openssl.org/source/openssl-1.1.1k.tar.gz.sha256
15+
OPENSSL_HASH=892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
16+
17+
cd /tmp
18+
19+
if ! perl -e 'use 5.10.0' &> /dev/null; then
20+
# perl>=5.10.0 is needed to build openssl
21+
PERL_ROOT=perl-5.32.1
22+
# Hash from https://www.cpan.org/src/5.0/perl-5.32.1.tar.gz.sha256.txt
23+
PERL_HASH=03b693901cd8ae807231b1787798cf1f2e0b8a56218d07b7da44f784a7caeb2c
24+
25+
curl -fsSLO https://www.cpan.org/src/5.0/${PERL_ROOT}.tar.gz
26+
check_sha256sum ${PERL_ROOT}.tar.gz ${PERL_HASH}
27+
tar -xzf ${PERL_ROOT}.tar.gz
28+
rm -rf ${PERL_ROOT}.tar.gz
29+
30+
pushd ${PERL_ROOT}
31+
./Configure -des -Dprefix=/tmp/perl-openssl > /dev/null
32+
make -j$(nproc) > /dev/null
33+
make install > /dev/null
34+
popd
35+
export PATH=/tmp/perl-openssl/bin:${PATH}
36+
fi
37+
38+
# Download
39+
curl -fsSLO http://www.openssl.org/source/${OPENSSL_ROOT}.tar.gz
40+
check_sha256sum ${OPENSSL_ROOT}.tar.gz ${OPENSSL_HASH}
41+
tar -xzf ${OPENSSL_ROOT}.tar.gz
42+
rm -rf ${OPENSSL_ROOT}.tar.gz
43+
44+
# Configure
45+
pushd ${OPENSSL_ROOT}
46+
./config no-shared -fPIC --prefix=/usr/local/ssl --openssldir=/usr/local/ssl > /dev/null
47+
48+
# Build
49+
make -j$(nproc) > /dev/null
50+
51+
# Install
52+
make install_sw > /dev/null
53+
54+
popd
55+
rm -rf ${OPENSSL_ROOT}

scripts/manylinux2014-build-and-install-openssl.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

scripts/manylinux2014-build-and-test-wheel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ MANYLINUX_PYTHON_BIN=/opt/python/cp38-cp38/bin
77
export PATH="${MANYLINUX_PYTHON_BIN}:$PATH"
88

99
cd /io
10-
./scripts/manylinux2014-build-and-install-openssl.sh /tmp/openssl-install shared
10+
./scripts/manylinux-build-and-install-openssl.sh
1111

1212
ci_before_install() {
1313
${MANYLINUX_PYTHON_BIN}/python scripts/ssl-check.py

0 commit comments

Comments
 (0)