Discussion:
How can I disable the strip binary option in rpmbuild?
(too old to reply)
d***@gmail.com
2008-06-09 08:13:58 UTC
Permalink
Hi,


I have an interesting scenario here.
The md5sum of my binary before rpmbuild is XXX.

After "rpmbuild -bb filename.spec",
I went to the location of my binary.
The md5sum of my binary after rpmbuild is YYY.

Basically, the binary still works perfectly. It is only the md5sum is
different before and after rpmbuild.

----------------------------------------------------------------------------------------

I noticed that in rpmbuild, it automatically strips the binary.
Hence I believe that this causes my binaries md5sum to differ.

I tried to strip the binary before rpmbuild, it does not help.
I looked into options of rpmbuild, no available clue on disabling the
strip option.

Please take note that my spec is only copying the existing binary from
source to destination.
There is no make install.

------------------------------------------------------------------------------------------

My question is:
1. Is the strip option causing the md5sum to differ?
2. If so, how can I disable the strip binary option in rpmbuild?

Thanks for reading,
Have a great day ahead.
Gilles Allard
2008-06-11 15:51:04 UTC
Permalink
Post by d***@gmail.com
1. Is the strip option causing the md5sum to differ?
I think that md5sum is for the whole file, binary or not. Stripping remove
the symbol section ( I assume the format of your file is Elf ); so the
content of the file and its structure are modified. The md5sum will be
different.
Post by d***@gmail.com
2. If so, how can I disable the strip binary option in rpmbuild?
You should have a look at the result of "rpm --showrc"; may be you will find
a macro "__os_install_post". Usually this is the step where files are
stripped running a script ( this is my case ); the definition of this
macros may resides in "/usr/lib/rpm/macros" or in some more specific macro
files. You should try to run rpmbuild using --define='__os_install_post
<what_you_need>'. This is the way I usually handle that point.

So hope this will help.
d***@gmail.com
2008-06-17 06:52:17 UTC
Permalink
Post by Gilles Allard
Post by d***@gmail.com
1. Is the strip option causing the md5sum to differ?
I think that md5sum is for the whole file, binary or not. Stripping remove
the symbol section ( I assume the format of your file is Elf ); so the
content of the file and its structure are modified. The md5sum will be
different.
Post by d***@gmail.com
2. If so, how can I disable the strip binary option in rpmbuild?
You should have a look at the result of "rpm --showrc"; may be you will find
a macro "__os_install_post". Usually this is the step where files are
stripped running a script ( this is my case ); the definition of this
macros may resides in "/usr/lib/rpm/macros" or in some more specific macro
files. You should try to run rpmbuild using --define='__os_install_post
<what_you_need>'. This is the way I usually handle that point.
So hope this will help.
Thanks
Managed to figure this out

in the define portion
add in
%define __os_install_post %{nil}

this will disable internal strip by rpmbuild.
However in the prompt out statements from rpmbuild, it still indicate
that stripping is done.

The other way I found out is that
in %install label
add in
export DONT_STRIP=1

This should helps too.
Thanks a million again.
: )

Loading...