b7580a
diff -r e8b8279ca118 setup.py
b7580a
--- a/setup.py	Sun Jul 21 21:57:52 2013 -0400
b7580a
+++ b/setup.py	Tue Aug 20 09:45:31 2013 +0200
b7580a
@@ -1480,12 +1480,21 @@
b7580a
                              'expat/xmltok_impl.h'
b7580a
                              ]
b7580a
 
b7580a
+        # Add an explicit RPATH to pyexpat.so pointing at the directory
b7580a
+        # containing the system expat (which has the extra XML_SetHashSalt
b7580a
+        # symbol), to avoid an ImportError with a link error if there's an
b7580a
+        # LD_LIBRARY_PATH containing a "vanilla" build of expat (without the
b7580a
+        # symbol) (rhbz#833271):
b7580a
+        EXPAT_RPATH = '/usr/lib64' if sys.maxint == 0x7fffffffffffffff else '/usr/lib'
b7580a
+
b7580a
+
b7580a
         exts.append(Extension('pyexpat',
b7580a
                               define_macros = define_macros,
b7580a
                               include_dirs = expat_inc,
b7580a
                               libraries = expat_lib,
b7580a
                               sources = ['pyexpat.c'] + expat_sources,
b7580a
                               depends = expat_depends,
b7580a
+                              extra_link_args = ['-Wl,-rpath,%s' % EXPAT_RPATH]
b7580a
                               ))
b7580a
 
b7580a
         # Fredrik Lundh's cElementTree module.  Note that this also