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