python3-008-no-rpath.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Remove runtime library paths
  2. For some extensions (sqlite and dbm), Python setup.py script
  3. hardcode a runtime path (rpath) into the extension. However, this
  4. runtime path is incorrect (because it points to the location of the
  5. library directory on the development machine) and useless (because on
  6. the target, all useful libraries are in a standard directory searched
  7. by the dynamic loader). For those reasons, we just get rid of the
  8. runtime paths in cross-compilation mode.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. ---
  11. setup.py | 12 ++++++++++--
  12. 1 file changed, 10 insertions(+), 2 deletions(-)
  13. Index: Python-3.3.0/setup.py
  14. ===================================================================
  15. --- Python-3.3.0.orig/setup.py
  16. +++ Python-3.3.0/setup.py
  17. @@ -1134,11 +1134,15 @@
  18. # can end up with a bad search path order.
  19. if sqlite_incdir not in self.compiler.include_dirs:
  20. include_dirs.append(sqlite_incdir)
  21. + if cross_compiling:
  22. + sqlite_runtime_libdir = None
  23. + else:
  24. + sqlite_runtime_libdir = sqlite_libdir
  25. exts.append(Extension('_sqlite3', sqlite_srcs,
  26. define_macros=sqlite_defines,
  27. include_dirs=include_dirs,
  28. library_dirs=sqlite_libdir,
  29. - runtime_library_dirs=sqlite_libdir,
  30. + runtime_library_dirs=sqlite_runtime_libdir,
  31. extra_link_args=sqlite_extra_link_args,
  32. libraries=["sqlite3",]))
  33. else:
  34. @@ -1205,9 +1209,13 @@
  35. elif cand == "bdb":
  36. if db_incs is not None:
  37. if dbm_setup_debug: print("building dbm using bdb")
  38. + if cross_compiling:
  39. + dblib_runtime_libdir = None
  40. + else:
  41. + dblib_runtime_libdir = dblib_dir
  42. dbmext = Extension('_dbm', ['_dbmmodule.c'],
  43. library_dirs=dblib_dir,
  44. - runtime_library_dirs=dblib_dir,
  45. + runtime_library_dirs=dblib_runtime_libdir,
  46. include_dirs=db_incs,
  47. define_macros=[
  48. ('HAVE_BERKDB_H', None),