(Not-)Linking with zlib

Loïc Minier lool+redhat at via.ecp.fr
Sun Nov 5 16:59:06 UTC 2006


 dmraid-1.0.0.rc13 started linking with zlib for crc32(), this is used
 to support "SNIA DDF1 v1.0 metadata".  Debian has libdevmapper in /lib
 and zlib in /usr/lib, so this makes the dynamic dmraid binary we're
 currently shipping unusable until your /usr is mounted.

 I see the RPM packages are shipping a dmraid.static alternative, but
 they seem to require /usr by default as well.

 It would be nice to avoid this dependency; solutions we have discussed
 for Debian in <http://bugs.debian.org/396762> were:
 1) copy crc32 from zlib
 2) implement crc32
 3) link statically with zlib (and only zlib)

 crc32() seems trivial to implement in C, here's a sample implementation
 with some optimizations (you might want to chop off the optims since
 metadata is probably not crc-ed a lot of times):

 I attach the patch to force linking statically with zlib, by Steve
 Langasek, but beware not to add any lib after zlib in the Makefile or
 these would *always* be linked dynamically obviously.

 You might want to drop the zlib dep because of the +12KB it causes
 (crc32() is IMO smaller).

Loïc Minier <lool at dooz.org>
-------------- next part --------------
diff -u dmraid-1.0.0.rc13/debian/changelog dmraid-1.0.0.rc13/debian/changelog
--- dmraid-1.0.0.rc13/debian/changelog
+++ dmraid-1.0.0.rc13/debian/changelog
@@ -1,3 +1,12 @@
+dmraid (1.0.0.rc13-1.1) unstable; urgency=low
+  * Non-maintainer upload.
+  * Statically link against libz, since we only need crc32 from it and
+    we can't have binaries in /sbin depending on libs in /usr/lib.
+    Closes: #396762.
+ -- Steve Langasek <vorlon at debian.org>  Fri,  3 Nov 2006 14:38:54 -0800
 dmraid (1.0.0.rc13-1) unstable; urgency=low
   * New upstream release; closes: #391499.
only in patch2:
--- dmraid-1.0.0.rc13.orig/1.0.0.rc13/tools/Makefile.in
+++ dmraid-1.0.0.rc13/1.0.0.rc13/tools/Makefile.in
@@ -20,7 +20,7 @@
-DMRAIDLIBS=-ldmraid -lz
+DMRAIDLIBS=-ldmraid -Wl,-Bstatic -lz -Wl,-Bdynamic
 include $(top_srcdir)/make.tmpl

More information about the Ataraid-list mailing list