Skip to content

zig bottle: zig ar behavior is inconsistent with official build #278849

@idawnlight

Description

@idawnlight

brew config AND brew doctor output OR brew gist-logs <formula> link

HOMEBREW_VERSION: 5.1.7-57-g5489c09
ORIGIN: https://github.com/Homebrew/brew
HEAD: 5489c09b004ceeaa6321254a4701dcde22484a61
Last commit: 2 hours ago
Branch: main
Core tap JSON: 22 Apr 09:28 UTC
Core cask tap JSON: 22 Apr 09:28 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DOWNLOAD_CONCURRENCY: 4
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 4.0.3 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.3/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 21.0.0 build 2100
Git: 2.50.1 => /Applications/Xcode-26.4.0.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.4.1-arm64
CLT: 26.4.1.0.1775747724
Xcode: 26.4 => /Applications/Xcode-26.4.0.app/Contents/Developer
Metal Toolchain: N/A
Rosetta 2: false

---
note: I do believe the `brew doctor` output below has nothing to do with this issue, and I still need these formulae.

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  icu4c@77
  php@7.4

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libDellMonitorSdkLib.dylib

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.
  • My issue is not about a failure to build a formula from source.

What were you trying to do (and why)?

Trying to create an archive with zig ar rcs test.a *.o, and it throws an unexpected error ar: error: unable to open 'test.a': No such file or directory.

What happened (include all command output)?

The Homebrew prebuilt zig 0.16.0 bottle can't create an archive with zig ar rcs test.a *.o, while the official binaries pulled from https://ziglang.org/download/0.16.0/zig-aarch64-macos-0.16.0.tar.xz don't have this issue.

# compile anything to produce a `.o` at working dir
> rm test.a
> ~/Downloads/zig-aarch64-macos-0.16.0/zig ar rcs test.a *.o
> ls -l test.a
.rw-r--r-- 264k idawnlight 22 Apr 18:32 test.a

> rm test.a
> /opt/homebrew/bin/zig ar rcs test.a *.o
ar: error: unable to open 'test.a': No such file or directory

What did you expect to happen?

zig installed from Homebrew should behave the same as the one downloaded from ziglang.org.

Step-by-step reproduction instructions (by running brew commands)

# compile anything to produce a `.o` at working dir
> rm test.a
> ~/Downloads/zig-aarch64-macos-0.16.0/zig ar rcs test.a *.o
> ls -l test.a
.rw-r--r-- 264k idawnlight 22 Apr 18:32 test.a

> rm test.a
> /opt/homebrew/bin/zig ar rcs test.a *.o
ar: error: unable to open 'test.a': No such file or directory

> ~/Downloads/zig-aarch64-macos-0.16.0/zig env
.{
    .zig_exe = "/Users/idawnlight/Downloads/zig-aarch64-macos-0.16.0/zig",
    .lib_dir = "/Users/idawnlight/Downloads/zig-aarch64-macos-0.16.0/lib",
    .std_dir = "/Users/idawnlight/Downloads/zig-aarch64-macos-0.16.0/lib/std",
    .global_cache_dir = "/Users/idawnlight/.cache/zig",
    .version = "0.16.0",
    .target = "aarch64-macos.26.4.1...26.4.1-none",
    .env = .{
        .ZIG_GLOBAL_CACHE_DIR = null,
        .ZIG_LOCAL_CACHE_DIR = null,
        .ZIG_LIB_DIR = null,
        .ZIG_LIBC = null,
        .ZIG_BUILD_RUNNER = null,
        .ZIG_BUILD_ERROR_STYLE = null,
        .ZIG_BUILD_MULTILINE_ERRORS = null,
        .ZIG_VERBOSE_LINK = null,
        .ZIG_VERBOSE_CC = null,
        .ZIG_DEBUG_CMD = null,
        .ZIG_IS_DETECTING_LIBC_PATHS = null,
        .ZIG_IS_TRYING_TO_NOT_CALL_ITSELF = null,
        .NIX_CFLAGS_COMPILE = null,
        .NIX_CFLAGS_LINK = null,
        .NIX_LDFLAGS = null,
        .C_INCLUDE_PATH = null,
        .CPLUS_INCLUDE_PATH = null,
        .LIBRARY_PATH = null,
        .CC = null,
        .NO_COLOR = null,
        .CLICOLOR_FORCE = null,
        .XDG_CACHE_HOME = null,
        .LOCALAPPDATA = null,
        .HOME = "/Users/idawnlight",
        .PROGRAMDATA = null,
        .HOMEBREW_PREFIX = null,
    },
}
> ~/Downloads/zig-aarch64-macos-0.16.0/zig ar --version
LLVM (http://llvm.org/):
  LLVM version 21.1.0
  Optimized build.

> /opt/homebrew/bin/zig env
.{
    .zig_exe = "/opt/homebrew/Cellar/zig/0.16.0/bin/zig",
    .lib_dir = "/opt/homebrew/Cellar/zig/0.16.0/lib/zig",
    .std_dir = "/opt/homebrew/Cellar/zig/0.16.0/lib/zig/std",
    .global_cache_dir = "/Users/idawnlight/.cache/zig",
    .version = "0.16.0",
    .target = "aarch64-macos.26.4.1...26.4.1-none",
    .env = .{
        .ZIG_GLOBAL_CACHE_DIR = null,
        .ZIG_LOCAL_CACHE_DIR = null,
        .ZIG_LIB_DIR = null,
        .ZIG_LIBC = null,
        .ZIG_BUILD_RUNNER = null,
        .ZIG_BUILD_ERROR_STYLE = null,
        .ZIG_BUILD_MULTILINE_ERRORS = null,
        .ZIG_VERBOSE_LINK = null,
        .ZIG_VERBOSE_CC = null,
        .ZIG_DEBUG_CMD = null,
        .ZIG_IS_DETECTING_LIBC_PATHS = null,
        .ZIG_IS_TRYING_TO_NOT_CALL_ITSELF = null,
        .NIX_CFLAGS_COMPILE = null,
        .NIX_CFLAGS_LINK = null,
        .NIX_LDFLAGS = null,
        .C_INCLUDE_PATH = null,
        .CPLUS_INCLUDE_PATH = null,
        .LIBRARY_PATH = null,
        .CC = null,
        .NO_COLOR = null,
        .CLICOLOR_FORCE = null,
        .XDG_CACHE_HOME = null,
        .LOCALAPPDATA = null,
        .HOME = "/Users/idawnlight",
        .PROGRAMDATA = null,
        .HOMEBREW_PREFIX = null,
    },
}
> /opt/homebrew/bin/zig ar --version
Homebrew LLVM version 21.1.8
  Optimized build.

# By the way, Homebrew LLVM 21.1.8 works
> /opt/homebrew/Cellar/llvm@21/21.1.8/bin/llvm-ar rcs test.a *.o
> ls -l test.a
.rw-r--r-- 264k idawnlight 22 Apr 18:54 test.a

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issueAn upstream issue report is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions