Skip to content

Zig build --help doesn't print help message #25316

@81hvac1k02

Description

@81hvac1k02

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

I installed zig on Windows 11 with winget install zig.zig. Then ran zig build --help in a empty directory.
Output: info: initialize build.zig template file with 'zig init' info: see 'zig --help' for more options error: no build.zig file found, in the current directory or any parent directories

Part 2:
I also tried cloning a existing project git clone https://github.com/allyourcodebase/cpython then run ´`zig build --help`` in it. It started compiling the project (and crashed),

zig build --help 
C:\Users\USER\AppData\Local\zig\p\zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h\build.zig:5:18: error: no field or member function named 'addStaticLibrary' in 'Build'
    const lib = b.addStaticLibrary(.{
                ~^~~~~~~~~~~~~~~~~
C:\Users\USER\AppData\Local\Microsoft\WinGet\Packages\zig.zig_Microsoft.Winget.Source_8wekyb3d8bbwe\zig-x86_64-windows-0.15.1\lib\std\Build.zig:1:1: note: struct declared here
const std = @import("std.zig");
^~~~~
C:\Users\USER\AppData\Local\zig\p\zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h\build.zig:5:18: note: method invocation only supports up to one level of implicit pointer dereferencing
C:\Users\USER\AppData\Local\zig\p\zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h\build.zig:5:18: note: use '.*' to dereference pointer
referenced by:
    runBuild__anon_82912: C:\Users\USER\AppData\Local\Microsoft\WinGet\Packages\zig.zig_Microsoft.Winget.Source_8wekyb3d8bbwe\zig-x86_64-windows-0.15.1\lib\std\Build.zig:2214:33
    dependencyInner__anon_78948: C:\Users\USER\AppData\Local\Microsoft\WinGet\Packages\zig.zig_Microsoft.Winget.Source_8wekyb3d8bbwe\zig-x86_64-windows-0.15.1\lib\std\Build.zig:2195:29
    8 reference(s) hidden; use '-freference-trace=10' to see all references
build.zig:1238:22: error: no field named 'autoconf' in union 'Build.Step.ConfigHeader.Style'
        .style = .{ .autoconf = upstream.path("pyconfig.h.in") },
                     ^~~~~~~~
C:\Users\USER\AppData\Local\Microsoft\WinGet\Packages\zig.zig_Microsoft.Winget.Source_8wekyb3d8bbwe\zig-x86_64-windows-0.15.1\lib\std\Build\Step\ConfigHeader.zig:7:19: note: union declared here
pub const Style = union(enum) {
                  ^~~~~ ``` 

### Expected Behavior

I expected to see the help menu. 

To just print a help menu shouldn't require me to create a empty project first. All it should do is print the help and exit. 
And i don't get why it starts compiling code instead of printing the help message. 

``zig --help``, ``zig cc --help`` and ``zig c++ --help`` all prints their respective help messages as expected without compiling anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionNo questions on the issue tracker, please.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions