Skip to content
Latchkey

strip: Usage, Options & Common CI Errors

strip discards symbol and debug information to produce a smaller release binary.

strip shrinks release artifacts by dropping symbols you do not ship. The CI nuance is keeping a separate debug file (so you can still symbolize crash backtraces) instead of throwing the debug info away entirely.

What it does

strip removes symbols and debugging sections from object files and executables, reducing size. It can strip everything (-s), only debug info (-g), or only unneeded symbols (--strip-unneeded), and can split debug info into a separate file.

Common usage

Terminal
strip app                          # remove all symbols
strip -g app                       # remove only debug info
strip --strip-unneeded libfoo.so   # safe for shared libs
objcopy --only-keep-debug app app.debug   # save debug first
strip app && objcopy --add-gnu-debuglink=app.debug app

Options

FlagWhat it does
-s / --strip-allRemove all symbol and relocation info
-g / --strip-debugRemove only debugging symbols
--strip-unneededRemove symbols not needed for relocation
-K <sym> / -N <sym>Keep / remove a named symbol
-o <file>Write stripped output elsewhere

Common errors in CI

Stripping too aggressively breaks shared libraries or plugins that rely on exported symbols - use --strip-unneeded (which keeps needed dynamic symbols) on .so files, not -s. After stripping, crash backtraces lose function names; save debug info first with objcopy --only-keep-debug and link it back via --add-gnu-debuglink so you can symbolize later. "Unable to recognise the format of the input file" means it is not a valid object (often already stripped or corrupt).

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →