pviktori / rpms / python2

Forked from rpms/python2 6 years ago
Clone
Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedora Python maintainers <python-devel@lists.fedoraproject.org>
Date: Wed, 15 Jul 2020 15:42:17 +0200
Subject: [PATCH] 00187-add-RPATH-to-pyexpat.patch

00187 #
Add an explicit RPATH to pyexpat.so pointing at the directory
containing the system expat (which has the extra XML_SetHashSalt
symbol), to avoid an ImportError with a link error if there's an
LD_LIBRARY_PATH containing a "vanilla" build of expat (without the
symbol)
---
 setup.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/setup.py b/setup.py
index 761efff449b..b401ab836a9 100644
--- a/setup.py
+++ b/setup.py
@@ -1536,12 +1536,21 @@ class PyBuildExt(build_ext):
                              'expat/xmltok_impl.h'
                              ]
 
+        # Add an explicit RPATH to pyexpat.so pointing at the directory
+        # containing the system expat (which has the extra XML_SetHashSalt
+        # symbol), to avoid an ImportError with a link error if there's an
+        # LD_LIBRARY_PATH containing a "vanilla" build of expat (without the
+        # symbol) (rhbz#833271):
+        EXPAT_RPATH = '/usr/lib64' if sys.maxint == 0x7fffffffffffffff else '/usr/lib'
+
+
         exts.append(Extension('pyexpat',
                               define_macros = define_macros,
                               include_dirs = expat_inc,
                               libraries = expat_lib,
                               sources = ['pyexpat.c'] + expat_sources,
                               depends = expat_depends,
+                              extra_link_args = ['-Wl,-rpath,%s' % EXPAT_RPATH]
                               ))
 
         # Fredrik Lundh's cElementTree module.  Note that this also