README.shlibdeps 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. In woody dpkg will use a different method to determine on which
  2. libraries a package should depend. Until now dpkg-shlibdeps has
  3. used the output of ldd to determine which libraries are needed.
  4. This will be changed to using objdump. This however changes
  5. will need a couple of changes in the way that packages are build.
  6. Let me first explain the differences between ldd and objdump.
  7. A binary itself is linked against 0 or more dynamic libraries, depending
  8. on how it is linked. Some of those libraries may need other libraries
  9. to do their work, so the linker will need to load those as well when
  10. the binary is executed. For example, to run xcdrgtk needs the following
  11. libraries according to ldd:
  12. libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x40019000)
  13. libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x4013d000)
  14. libImlib.so.1 => /usr/lib/libImlib.so.1 (0x40170000)
  15. libgdk_imlib.so.1 => /usr/lib/libgdk_imlib.so.1 (0x401ab000)
  16. libc.so.6 => /lib/libc.so.6 (0x401d9000)
  17. libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x402b5000)
  18. libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x402b8000)
  19. libdl.so.2 => /lib/libdl.so.2 (0x402da000)
  20. libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x402de000)
  21. libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x402e6000)
  22. libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x402f3000)
  23. libm.so.6 => /lib/libm.so.6 (0x40392000)
  24. libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x403af000)
  25. libtiff.so.3 => /usr/lib/libtiff.so.3 (0x403cf000)
  26. libungif.so.3 => /usr/lib/libungif.so.3 (0x40411000)
  27. libpng.so.2 => /usr/lib/libpng.so.2 (0x4041a000)
  28. libz.so.1 => /usr/lib/libz.so.1 (0x40442000)
  29. /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
  30. Now if we leek a bit closed we see that xcdrgtk actually only links to
  31. a couple of those libraries directly. The actual depencies are a tree
  32. which looks something like this: (anyone interested in writing a tool
  33. to make such a graph?)
  34. xcdrgtk
  35. +- libc
  36. +- gtk
  37. +- gdk
  38. | +- libXi
  39. | +- libXext
  40. | \- libX11
  41. +- Imlib
  42. | +- libjpeg
  43. | +- libtiff
  44. | | +- libjpeg
  45. | | +- libm
  46. | | \- libz
  47. | +- libungif
  48. | | \- libX11
  49. | +- libpng
  50. | | +- libz
  51. | | \- libm
  52. | +- libz
  53. | \- libm
  54. \- gdk_imlib
  55. +- libgmodule-1.2
  56. | \- libdl
  57. +- libglib-1.2
  58. \- libdl
  59. \- ld-linux
  60. (I haven't listed libc in here, but all libraries are also linked to
  61. libc).
  62. What ldd does is give us a complete list of every library that is needed
  63. to run the binary (in other words, if flattens this tree). objdump
  64. however can tell us exactly what library something is linked with. For
  65. the same xcdrgtk binary it will tell us:
  66. NEEDED libgtk-1.2.so.0
  67. NEEDED libgdk-1.2.so.0
  68. NEEDED libImlib.so.1
  69. NEEDED libgdk_imlib.so.1
  70. NEEDED libc.so.6
  71. All the other libraries are automatically pulled in by the dynamic
  72. loader.
  73. And now for the connection to package management: a package only
  74. needs to depend on the libraries it is directly linked to, since the
  75. dependencies for those libraries should automatically pull in the
  76. other libraries.
  77. This change does mean a change in the way packages are build though:
  78. currently dpkg-shlibdeps is only run on binaries. But since we will
  79. now depend on the libraries to depend on the libraries they need
  80. the packages containing those libraries will need to run dpkg-shlibdeps
  81. on the libraries. That may sound a bit strange, so here is an example:
  82. Generally a package does this in debian/rules:
  83. dpkg-shlibdeps debian/tmp/usr/bin/*
  84. This will need to be changes to:
  85. dpkg-shlibdeps debian/tmp/usr/bin/* debian/tmp/usr/lib/lib*.so.*
  86. For lib* packages which don't generally contain libraries and didn't
  87. run dpkg-shlibdeps a dpkg-shlibdeps call will need to be added as well.
  88. This gives us a lot more flexibility in the way libraries are packaged.
  89. A good example where this would help us is the current mess with
  90. multiple version of the mesa library. With the ldd-based system
  91. every package that uses mesa need to add a dependency on
  92. svgalib|svgalib-dummy in order to handle the glide mesa variant.
  93. With an objdump-based system this isn't necessary anymore and would
  94. have saved everyone a lot of work.
  95. Another example: we could update libimlib with a new version that supports
  96. a new graphics format called dgf. If we use the old ldd method every
  97. package that uses libimlib would need to be recompiled so it would also
  98. depend on libdgf or it wouldn't run due to missing symbols. However with
  99. the new system packages using libimlib can depend on libimlib itself
  100. having the dependency on libgdh and wouldn't need to be updated.