Use objcopy
or strip
from binutils
to strip debug symbols from the binaries that you are building. I would, however, suggest that you either keep an unstripped copy of the binaries or - in case of using objcopy
- simply split off the debug symbols into a separate file that can later be used with a debugger.
Often the *-devel
packages come with symbols of the corresponding *
package, by the way. So you may want to consider creating one of those in addition, if this is something you release to the general public.
For strip a common use is to only strip the debugging symbols:
strip -S -o [stripped-file] [input-file]
The switch corresponding to strip -S
for is objcopy -g
or simply use the long form that works for both (but not on all platforms on which I had to use strip
): --strip-debug
.
For the described use of splitting the debug symbols using objcopy
, check out the option --only-keep-debug
in man objcopy
.