PDA

View Full Version : [SOLVED] Getting rpmbuild to make stripped binaries?


cazo
3rd January 2011, 10:18 AM
I have a few packages that I (re)build for personal use, and have noticed that rpmbuild doesn't make 'stripped' binaries by default (for me).

It doesn't make a significant difference in size, but rpmlint spits out

W: unstripped-binary-or-object

warnings for the various programs & libraries in the package.


I have edited some of the .spec file(s) to change the 'make install' to 'make install-strip', but this depends on the makefile (and is probably not the best way).


I've also tried rebuilding some packages using

rpmbuild --rebuild --with some_option package.src.rpm

which builds from the (uninstalled) .src.rpm file.


Any help is appreciated.

leigh123linux
3rd January 2011, 10:25 AM
I have a few packages that I (re)build for personal use, and have noticed that rpmbuild doesn't make 'stripped' binaries by default (for me).

It doesn't make a significant difference in size, but rpmlint spits out

W: unstripped-binary-or-object
warnings for the various programs & libraries in the package.


I have edited some of the .spec file(s) to change the 'make install' to 'make install-strip', but this depends on the makefile (and is probably not the best way).


I've also tried rebuilding some packages using

rpmbuild --rebuild --with some_option package.src.rpm
which builds from the (uninstalled) .src.rpm file.


Any help is appreciated.


su
yum install redhat-rpm-config

Then try again ;)

cazo
3rd January 2011, 11:13 AM

Thanks! I must have missed that one. I'm rebuilding the package now to check.

I just noticed that I already had that file on my Fedora 11 system, and it has the same problem about building unstripped binaries. (I know that's EOL, but part of the reason I haven't upgraded it yet is I'm cleaning up those self-build packages as I copy them over to my Fedora 13 system & rebuild them there).

Also, during the builds, rpmbuild spits out lines like

...
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
...


without redhat-rpm-config and


...
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot /usr/lib/rpm/redhat/brp-strip
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
...

with redhat-rpm-config.

Another curiosity: it looks like the packages I built using mock (on Fedora 11) did get stripped, but not the ones I built as a regular user. :confused:

leigh123linux
3rd January 2011, 11:19 AM
Thanks! I must have missed that one. I'm rebuilding the package now to check.

I just noticed that I already had that file on my Fedora 11 system, and it has the same problem about building unstripped binaries. (I know that's EOL, but part of the reason I haven't upgraded it yet is I'm cleaning up those self-build packages as I copy them over to my Fedora 13 system & rebuild them there).

Also, during the builds, rpmbuild spits out lines like

...
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
...
without redhat-rpm-config and


...
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot /usr/lib/rpm/redhat/brp-strip
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
...
with redhat-rpm-config.

Another curiosity: it looks like the packages I built using mock (on Fedora 11) did get stripped, but not the ones I built as a regular user. :confused:

redhat-rpm-config is a default package for the mock buildroot.

cazo
3rd January 2011, 12:09 PM
redhat-rpm-config is a default package for the mock buildroot.

OK, that clears it up!

Maybe redhat-rpm-config should get pulled in with rpmdevtools? Don't worry, that's just a rhetorical question:)

I'm marking this one as solved (since it takes care of the problem for me on Fedora 13).

That made me check something, and I think I've found where the problem happens:

On my Fedora 11 box, my .rpmmacros contains an added:

%debug_package %{nil}

(to not build debug packages). With that, it only builds unstripped binaries. When I comment out that line, I get stripped binaries - but also a debug package gets built.

I understand (at least I think I do) the use of debug packages & stripping binaries (of the symbols useful for debugging) - but this has me confused:confused:

I thought I wanted to skip building the debug packages & strip the binaries (or have I got that a$$-backwards?).

Anyways, I do ThankYou for your help & would appreciate any explanation/tips/insight you care to offer.

leigh123linux
3rd January 2011, 01:28 PM
You should only use this option to disable the debug package (doing this stops the stripping) if there is a build problem.

%debug_package %{nil}

cazo
4th January 2011, 12:55 AM
OK, then I'll just 'ignore' the debug packages being built.

I really appreciate your help with solving these two (or more) problems!