[CentOS-devel] Libraries not stripped in rebuilt rpms and larger packages

Luigi Iotti centos1 at iotti.biz
Wed Jul 8 17:35:02 UTC 2009


Hi all

I usually rebuild some CentOS rpm packges with some changes I need.
I noticed that I obtain slightly larger packages than the ones found in the
centOS distribution, even if I rebuild a source rpm without changing
anything.
I looked in it, and it turned out that my shared libraries are not stripped,
where the ones found in your packages are.
For example, I just rebuilt the openldap packages, and obtained a package
that is about 3 times larger:
-rw-r--r-- 1 root root 10899106 Jul  7 22:42
my/openldap-servers-2.3.43-3.el5.lux.2.i386.rpm
-rw-r--r-- 1 root root  3202917 Jul  8 16:38
orig/openldap-servers-2.3.43-3.el5.i386.rpm

I extracted the packages with rpm2cpio, and the difference in size are in
the shared libraries, for example:
# ls -l */usr/lib/libslapd_db-4.4.so
-rwxr-xr-x 1 root root 6518365 Jul  8 16:42 my/usr/lib/libslapd_db-4.4.so
-rwxr-xr-x 1 root root 1032880 Jan 21 10:00 orig/usr/lib/libslapd_db-4.4.so
# file */usr/lib/libslapd_db-4.4.so
my/usr/lib/libslapd_db-4.4.so:   ELF 32-bit LSB shared object, Intel 80386,
version 1 (SYSV), not stripped
orig/usr/lib/libslapd_db-4.4.so: ELF 32-bit LSB shared object, Intel 80386,
version 1 (SYSV), stripped

Maybe the CentOS build system contains some macros that strip libraries, and
the distributed macros do not.

I put this in /etc/rpm/macros (the line calling brp-strip-shared was added
to the analogous macro taken from /usr/lib/rpm/redhat):
%__os_install_post    \
    /usr/lib/rpm/redhat/brp-compress \
    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip-shared %{__strip}} \
    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
    /usr/lib/rpm/brp-python-bytecompile \
    /usr/lib/rpm/redhat/brp-java-repack-jars \
%{nil}

Do you see any problems doing so?
Why there is this difference between packages distributed by CentOS and the
same packages rebuilt in a CentOS environment?

Thank you



More information about the CentOS-devel mailing list