From 3ff9de8ac6937c1a9dacd50c40f1aed4a7ce2beb Mon Sep 17 00:00:00 2001 From: Manoj Srivastava Date: Thu, 16 Jun 2005 05:08:08 +0000 Subject: [PATCH] Shared library handling changes due to forthcoming dpkg changes Author: srivasta Date: 2000/07/16 14:54:04 Shared library handling changes due to forthcoming dpkg changes git-archimport-id: srivasta@debian.org--etch/debian-policy--devel--3.0--patch-55 --- README.shlibdeps | 118 +++++++++++++++++++++++++++++++++ packaging.sgml | 24 +++++-- policy.sgml | 3 + virtual-package-names-list.txt | 10 +++ 4 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 README.shlibdeps diff --git a/README.shlibdeps b/README.shlibdeps new file mode 100644 index 0000000..14780d7 --- /dev/null +++ b/README.shlibdeps @@ -0,0 +1,118 @@ +In woody dpkg will use a different method to determine on which +libraries a package should depend. Until now dpkg-shlibdeps has +used the output of ldd to determine which libraries are needed. +This will be changed to using objdump. This however changes +will need a couple of changes in the way that packages are build. + +Let me first explain the differences between ldd and objdump. +A binary itself is linked against 0 or more dynamic libraries, depending +on how it is linked. Some of those libraries may need other libraries +to do their work, so the linker will need to load those as well when +the binary is executed. For example, to run xcdrgtk needs the following +libraries according to ldd: + + libgtk-1.2.so.0 =3D> /usr/lib/libgtk-1.2.so.0 (0x40019000) + libgdk-1.2.so.0 =3D> /usr/lib/libgdk-1.2.so.0 (0x4013d000) + libImlib.so.1 =3D> /usr/lib/libImlib.so.1 (0x40170000) + libgdk_imlib.so.1 =3D> /usr/lib/libgdk_imlib.so.1 (0x401ab000) + libc.so.6 =3D> /lib/libc.so.6 (0x401d9000) + libgmodule-1.2.so.0 =3D> /usr/lib/libgmodule-1.2.so.0 (0x402b5000) + libglib-1.2.so.0 =3D> /usr/lib/libglib-1.2.so.0 (0x402b8000) + libdl.so.2 =3D> /lib/libdl.so.2 (0x402da000) + libXi.so.6 =3D> /usr/X11R6/lib/libXi.so.6 (0x402de000) + libXext.so.6 =3D> /usr/X11R6/lib/libXext.so.6 (0x402e6000) + libX11.so.6 =3D> /usr/X11R6/lib/libX11.so.6 (0x402f3000) + libm.so.6 =3D> /lib/libm.so.6 (0x40392000) + libjpeg.so.62 =3D> /usr/lib/libjpeg.so.62 (0x403af000) + libtiff.so.3 =3D> /usr/lib/libtiff.so.3 (0x403cf000) + libungif.so.3 =3D> /usr/lib/libungif.so.3 (0x40411000) + libpng.so.2 =3D> /usr/lib/libpng.so.2 (0x4041a000) + libz.so.1 =3D> /usr/lib/libz.so.1 (0x40442000) + /lib/ld-linux.so.2 =3D> /lib/ld-linux.so.2 (0x40000000) + +Now if we leek a bit closed we see that xcdrgtk actually only links to +a couple of those libraries directly. The actual depencies are a tree +which looks something like this: (anyone interested in writing a tool +to make such a graph?) + + xcdrgtk + +- libc + +- gtk + +- gdk + | +- libXi + | +- libXext + | \- libX11 + +- Imlib + | +- libjpeg + | +- libtiff + | | +- libjpeg + | | +- libm + | | \- libz + | +- libungif + | | \- libX11 + | +- libpng + | | +- libz + | | \- libm + | +- libz + | \- libm + \- gdk_imlib + +- libgmodule-1.2 + | \- libdl + +- libglib-1.2 + \- libdl + \- ld-linux + +(I haven't listed libc in here, but all libraries are also linked to +libc). + +What ldd does is give us a complete list of every library that is needed +to run the binary (in other words, if flattens this tree). objdump +however can tell us exactly what library something is linked with. For +the same xcdrgtk binary it will tell us: + + NEEDED libgtk-1.2.so.0 + NEEDED libgdk-1.2.so.0 + NEEDED libImlib.so.1 + NEEDED libgdk_imlib.so.1 + NEEDED libc.so.6 + +All the other libraries are automatically pulled in by the dynamic +loader. + +And now for the connection to package management: a package only +needs to depend on the libraries it is directly linked to, since the +dependencies for those libraries should automatically pull in the +other libraries. + +This change does mean a change in the way packages are build though: +currently dpkg-shlibdeps is only run on binaries. But since we will +now depend on the libraries to depend on the libraries they need +the packages containing those libraries will need to run dpkg-shlibdeps +on the libraries. That may sound a bit strange, so here is an example: + +Generally a package does this in debian/rules: + + dpkg-shlibdeps debian/tmp/usr/bin/* + +This will need to be changes to: + + dpkg-shlibdeps debian/tmp/usr/bin/* debian/tmp/usr/lib/lib*.so.* + +For lib* packages which don't generally contain libraries and didn't +run dpkg-shlibdeps a dpkg-shlibdeps call will need to be added as well. + +This gives us a lot more flexibility in the way libraries are packaged. + +A good example where this would help us is the current mess with +multiple version of the mesa library. With the ldd-based system +every package that uses mesa need to add a dependency on +svgalib|svgalib-dummy in order to handle the glide mesa variant. +With an objdump-based system this isn't necessary anymore and would +have saved everyone a lot of work. + +Another example: we could update libimlib with a new version that supports +a new graphics format called dgf. If we use the old ldd method every +package that uses libimlib would need to be recompiled so it would also +depend on libdgf or it wouldn't run due to missing symbols. However with +the new system packages using libimlib can depend on libimlib itself +having the dependency on libgdh and wouldn't need to be updated. diff --git a/packaging.sgml b/packaging.sgml index 941ffde..094a62f 100644 --- a/packaging.sgml +++ b/packaging.sgml @@ -32,6 +32,10 @@ Maintainer: Manoj Srivastava srivasta@debian.org + + Maintainer: Julian Gilbey + J.D.Gilbey@qmw.ac.uk + Maintainer: The Debian Policy group debian-policy@lists.debian.org @@ -56,6 +60,9 @@

Philip Hands phil@hands.com

+ +

Julian Gilbey J.D.Gilbey@qmw.ac.uk

+

Manoj Srivastava srivasta@debian.org

@@ -731,7 +738,7 @@

- Its arguments are executables + Its arguments are executables and libraries

They may be specified either in the locations in the @@ -744,7 +751,7 @@

- If some of the executable(s) shared libraries should only + If some of the found shared libraries should only warrant a Recommends or Suggests, or if some warrant a Pre-Depends, this can be achieved by using the -ddependency-field option @@ -4645,11 +4652,16 @@ How does dpkg-shlibdeps work? -

- dpkg-shlibdeps calls ldd to - determine the shared libraries used by the compiled - binaries passed through its command line. + dpkg-shlibdeps calls objdump to + determine the shared libraries directly + a binary foo directly use a library + libbar if it is linked with that library. Other + libraries that are needed by libbar are linked + indirectly to foo, and the dynamic linker will load + the automatically when it loads libbar. + used by the compiled binaries and libraries + passed through its command line.

diff --git a/policy.sgml b/policy.sgml index 3238eb7..28a3399 100644 --- a/policy.sgml +++ b/policy.sgml @@ -60,6 +60,9 @@

Philip Hands phil@hands.com

+ +

Julian Gilbey J.D.Gilbey@qmw.ac.uk

+

Manoj Srivastava srivasta@debian.org

diff --git a/virtual-package-names-list.txt b/virtual-package-names-list.txt index 7ed8294..1441c00 100644 --- a/virtual-package-names-list.txt +++ b/virtual-package-names-list.txt @@ -77,6 +77,7 @@ ispell-dictionary Anything providing a dictionary for the kernel-headers Kernel header files (, ) kernel-image Kernel image (vmlinuz, System.map, modules) kernel-source Kernel source code +linux-kernel-log-daemon A daemon to facilitate logging for the Linux kernel lambdamoo-core A lambdamoo-compatible datebase package lambdamoo-server Anything running a moo using a lambdamoo-core libc-dev Anything that provides header and object files @@ -87,6 +88,8 @@ pdf-preview Any preprocessor that creates PDF output pdf-viewer Anything that can display PDF files postscript-preview Any preprocessor that creates Postscript output postscript-viewer Anything that can display Postscript files +system-log-daemon A daemon that provides a logging facility for + other applications tclsh Anything that provides /usr/bin/tclsh (*) ups-monitor Anything that is capable of controlling an UPS wish Anything that provides /usr/bin/wish (*) @@ -162,3 +165,10 @@ Julian Gilbey Added man-browser Added ident-server Alphabeticised lists + +Manoj Srivastava + 11 July 2000 Added x-terminal-emulator + Added x-window-manager + Added xserver + Added linux-kernel-log-daemon + Added system-log-faemon -- 2.39.2