# build/ObjCopy: strip debug info to a separate elf file\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/2da28d93dec0e9e484076def63e690384a4a5b1f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 2da28d93dec0e9e484076def63e690384a4a5b1f

Requested commit: 2da28d93dec0e9e484076def63e690384a4a5b1f

Commit: 2da28d93dec0e9e484076def63e690384a4a5b1f

Tree: e30aad29afc3c65b1b32dd192113e520718825b0

Author: Xavier Bouchoux

Committer: Xavier Bouchoux

## Message

```
build/ObjCopy: strip debug info to a separate elf file.

example usage:
    if (!strip) {
        b.installArtifact(exe);
    } else {
        const stripped_exe = b.addObjCopy(exe.getEmittedBin(), .{
            .basename = exe.out_filename, // set the name for the debuglink
            .compress_debug = true,
            .strip = .debug_and_symbols,
            .extract_to_separate_file = true,
        });
        b.getInstallStep().dependOn(&b.addInstallBinFile(stripped_exe.getOutput(), exe.out_filename).step);
        b.getInstallStep().dependOn(&b.addInstallBinFile(stripped_exe.getOutputSeparatedDebug().?, b.fmt("{s}.debug", .{exe.out_filename})).step);
    }

```

## Parents

- [aecc15391a4c37a4504d29cb7e3179990b180773](https://git.cafe/gitcafe/zig/commit/aecc15391a4c37a4504d29cb7e3179990b180773?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/2da28d93dec0e9e484076def63e690384a4a5b1f?format=markdown)
