How to prevent a binary from being stripped by rpmbuild?

Richard W.M. Jones rjones at
Sat Dec 10 12:45:26 UTC 2011

On Fri, Dec 09, 2011 at 09:34:16PM -0500, Josh Boyer wrote:
> On Fri, Dec 9, 2011 at 7:32 PM, David Howells <dhowells at> wrote:
> >
> > Hi,
> >
> > How do I prevent rpmbuild from attempting to strip a particular binary?  The
> > problem is that the binary was cross-compiled and is not of the same
> > architecture as the normal Fedora binutils.  Thus the strip program used (from
> > the wrong binutils) appears to corrupt the binary.
> You probably need to disable debuginfo packages if that is the case.
> You might also want to redefine %{__strip} to the appropriate
> cross-strip utility, or /bin/true.  Something like:
> %define debug_package %{nil}
> %define __strip /bin/true

As well as this you may also need to stop prelink from breaking the
cross-compiled binaries.  This can be particularly insidious because
the binary will work after installation right up til the next
overnight prelink run.

Here's how to stop prelink:

mkdir -p $RPM_BUILD_ROOT/etc/prelink.conf.d
echo '-b /usr/bin/name' > $RPM_BUILD_ROOT/etc/prelink.conf.d/%{name}.conf


Richard Jones, Virtualization Group, Red Hat
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.

More information about the devel mailing list