Skip to content

Conversation

@meator
Copy link
Contributor

@meator meator commented Aug 18, 2025

Problems with Zig >=0.14.1

  • The logs report zig rc >=0.14.1 as

    Windows resource compiler: Drop-in compatible with the Microsoft Resource Compiler.
    

    This description should be sufficient, but it's unfortunate that even the new fixed version of Zig fails to identify itself as Zig.

  • Zig >=0.14.0 added support for the following flags:

      /:output-format <value>   If not specified, the output format is inferred.
        res                     (default if output format cannot be inferred)
        coff                    COFF object file (extension: .obj or .o)
        rcpp                    Preprocessed .rc file, implies /p
    

    This makes zig rc's output more flexible. If I'm not mistaken, zig rc /:output-format coff would qualify it as ResourceCompilerType.windres instead of the currently used ResourceCompilerType.rc. But to my (limited) knowledge, GNU windres can also output several formats.

    Detecting the output mode specified by the user in the cross file or elsewhere is probably not worth the effort, but I wanted to document this fact somewhere.

Choice of identifier string

The choice of identifier string is tricky. I went with the suggestion at #14372 (comment). I can change it to something else if requested.

I have compiled the outputs of --version, --help and /? of all known Windows Resource Compilers: https://gist.github.com/meator/d427310ec1128066ee72400522bbe0b4 This list can help with picking good identifier strings.

Testing

I was able to successfully configure a builddir with Zig versions 0.13.0, 0.14.0 and 0.14.1. I tested this on my WIP android-tools fork. I wasn't able to fully compile the project for unrelated reasons1, so that could perhaps use some more testing. The PR's changes are fairly simple, it shouldn't break anything.

I haven't added any unit tests because I don't think that would be appropriate here. The test would have to depend on Zig.

closes #14372

Footnotes

  1. android-tools depends on pthreads. Zig added support for these in 0.14.0 as documented in https://ziglang.org/download/0.14.0/release-notes.html#MinGW-w64. It also indirectly requires windows.globalization.h, which to my knowledge isn't bundled in Zig yet.

@meator meator requested a review from jpakkane as a code owner August 18, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zig rc not detected correctly by windows.py

1 participant