Skip to content

Commit

Permalink
Patch auditwheel to fix libstem.so rpath issue
Browse files Browse the repository at this point in the history
pypa/auditwheel#136 results in pure C++ libraries not getting patched
by auditwheel. This is a problem for us, since our pure C++ library,
libstem.so, needs its rpath patched for hdf5.

pypa/auditwheel#283 fixes this issue, but is not yet merged. Until
it gets merged and added to quay.io/pypa/manylinux2010_x86_64,
we will patch auditwheel inside quay.io/pypa/manylinux2010_x86_64 to
include this fix.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
  • Loading branch information
psavery committed Feb 19, 2021
1 parent a4e4cf1 commit 32fa048
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
CIBW_SKIP: "cp27-* pp* *-manylinux_i686 *-win32"

# This has some of the software we need pre-installed on it
CIBW_MANYLINUX_X86_64_IMAGE: openchemistry/stempy_manylinux2010_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: openchemistry/stempy_wheel_builder

# Need to do some setup before repairing the wheel on linux...
CIBW_REPAIR_WHEEL_COMMAND_LINUX: bash scripts/github-actions/repair_command_linux.sh
Expand Down
10 changes: 10 additions & 0 deletions scripts/github-actions/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ RUN VERSION=3.19.4 && \
wget -q https://github.com/Kitware/CMake/releases/download/v$VERSION/cmake-$VERSION-Linux-x86_64.sh && \
bash cmake-$VERSION-Linux-x86_64.sh --skip-license --prefix=/usr/local && \
rm cmake-$VERSION-Linux-x86_64.sh

# Apply the code patch from https://github.com/pypa/auditwheel/pull/283
# This allows for non-python dependencies to get their RPATHs patched, which
# we need so that libstem.so can get patched for HDF5
# FIXME: when https://github.com/pypa/auditwheel/pull/283 is merged and
# a part of quay.io/pypa/manylinux2010_x86_64, we can remove these lines.
COPY auditwheel_pr_283.patch /
RUN cd /opt/_internal/tools/lib/python3.7/site-packages && \
patch -p1 < /auditwheel_pr_283.patch && \
rm /auditwheel_pr_283.patch
24 changes: 24 additions & 0 deletions scripts/github-actions/docker/auditwheel_pr_283.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/auditwheel/wheel_abi.py b/auditwheel/wheel_abi.py
index 69f83ce..7875f6e 100644
--- a/auditwheel/wheel_abi.py
+++ b/auditwheel/wheel_abi.py
@@ -118,10 +118,16 @@ def get_wheel_elfdata(wheel_fn: str):
# we should walk its elftree.
if basename(fn) not in needed_libs:
full_elftree[fn] = nonpy_elftree[fn]
- full_external_refs[fn] = lddtree_external_references(
- nonpy_elftree[fn], ctx.path)

- log.debug(json.dumps(full_elftree, indent=4))
+ # Even if a non-pyextension ELF file is not needed, we
+ # should include it as an external references, because
+ # they might also require external libraries.
+ full_external_refs[fn] = lddtree_external_references(
+ nonpy_elftree[fn], ctx.path)
+
+ log.debug('full_elftree:\n%s', json.dumps(full_elftree, indent=4))
+ log.debug('full_external_refs (will be repaired):\n%s',
+ json.dumps(full_external_refs, indent=4))

return (full_elftree, full_external_refs, versioned_symbols,
uses_ucs2_symbols, uses_PyFPE_jbuf)
2 changes: 1 addition & 1 deletion scripts/github-actions/docker/build_and_push.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

image_base=quay.io/pypa/manylinux2010_x86_64
tag=openchemistry/stempy_manylinux2010_x86_64
tag=openchemistry/stempy_wheel_builder

docker build . -t $tag --build-arg BASE_IMAGE=$image_base
docker push $tag

0 comments on commit 32fa048

Please sign in to comment.