# Declare a target as unsupported in build.zig

**URL:** <https://ziggit.dev/t/declare-a-target-as-unsupported-in-build-zig/9348>\
**Category:** Help\
**Tags:** build-system\
**Created:** [March 30, 2025, 1:13am UTC](https://ziggit.dev/t/declare-a-target-as-unsupported-in-build-zig/9348 "2025-03-30T01:13:11Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tensorush](https://ziggit.dev/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tensorush](https://ziggit.dev/u/tensorush)\
**Post date:** [March 30, 2025, 4:06am UTC](https://ziggit.dev/t/declare-a-target-as-unsupported-in-build-zig/9348/3 "2025-03-30T04:06:45Z")

</div>

I’ve had a similar issue when trying to run [`scoop`](https://ziggit.dev/t/scoop-darwin-performance-counter-observation-library/9013)’s `doc` and `fmt` steps on Linux CI/CD runners.

I solved it by returning either a public Darwin or a private Linux module from an `if`/`else` block:

> **[scoop/build.zig at main](https://codeberg.org/tensorush/scoop/src/branch/main/build.zig#L13-L34)**
>
> scoop - Darwin performance counter observation library.

If you’d still like to let Linux users know that their OS isn’t supported you can `std.log.err` your message.

In general, when it comes to handling failing cases you shouldn’t reach for errors, but rather consider using either `b.addFail`, `std.log.err`, or `@panic`/`std.debug.panic`.

UPD: I’ve added failing case handling to the Doc:

> [@Build System Tricks](https://ziggit.dev/t/build-system-tricks/3531#p-12644-h-8-handle-failing-cases-9):
>
> This community-driven doc is an attempt to expand on the [official Zig Build System documentation](https://ziglang.org/learn/build-system/) as well as the past community contributions by [xq](https://zig.news/xq/series/2), [Sobeston](https://zig.guide/build-system/build-modes/) and others. Here you’ll find a list of tricks on how to use every part of the build system while making sure to conveniently name and lay out your build steps. I. Basic Usage 1) Declare commonly used information upfront // Resolve a query for a custom target const my\_target = b.resolveTargetQuery(.{ .cpu\_arch = .wasm32, .os\_tag =…

---

_[View the full topic](https://ziggit.dev/t/declare-a-target-as-unsupported-in-build-zig/9348)._
