Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig build --help fails when the build.zig file has an error #19996

Open
GrayHatter opened this issue May 18, 2024 · 2 comments
Open

zig build --help fails when the build.zig file has an error #19996

GrayHatter opened this issue May 18, 2024 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior zig build system
Milestone

Comments

@GrayHatter
Copy link
Sponsor Contributor

GrayHatter commented May 18, 2024

Zig Version

0.13.0-dev.39+f6f7a47aa

Steps to Reproduce and Observed Behavior

grayhatter@host ~/code/zig $ zig build --help
/home/grayhatter/code/zig/build.zig:708:45: error: no field named 'visionos' in enum 'Target.Os.Tag'
            .ios, .macos, .watchos, .tvos, .visionos => {
                                           ~^~~~~~~~
/usr/lib/zig/std/Target.zig:18:21: note: enum declared here
    pub const Tag = enum {
                    ^~~~
referenced by:
    build: /home/grayhatter/code/zig/build.zig:328:17
    runBuild__anon_8954: /usr/lib/zig/std/Build.zig:2080:37
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Expected Behavior

I expected the help options to print (in this case I wanted --zig-lib-dir [arg]Override path to Zig lib directory)

output of zig build --help for ziglang
grayhatter@host ~/code/zig $ zig build --help
Usage: /usr/bin/zig build [steps] [options]

Steps:
  install (default)            Copy build artifacts to prefix path
  uninstall                    Remove build artifacts from prefix path
  test                         Run all the tests
  langref                      Build and install the language reference
  std-docs                     Build and install the standard library documentation
  docs                         Build and install documentation
  test-fmt                     Check source files having conforming formatting
  test-cases                   Run the main compiler test cases
  test-translate-c             Run the C translation tests
  test-run-translated-c        Run the Run-Translated-C tests
  test-behavior                Run the behavior tests
  test-c-import                Run the @cImport tests
  test-compiler-rt             Run the compiler_rt tests
  test-universal-libc          Run the universal libc tests
  test-compare-output          Run the compare output tests
  test-standalone              Run the standalone tests
  test-c-abi                   Run the C ABI tests
  test-link                    Run the linker tests
  test-stack-traces            Run the stack trace tests
  test-cli                     Test the command line interface
  test-asm-link                Run the assemble and link tests
  test-std                     Run the standard library tests
  update-zig1                  Update stage1/zig1.wasm
  fmt                          Modify source files in place to have conforming formatting
  update-mingw                 Update zig's bundled mingw

General Options:
  -p, --prefix [path]          Where to install files (default: zig-out)
  --prefix-lib-dir [path]      Where to install libraries
  --prefix-exe-dir [path]      Where to install executables
  --prefix-include-dir [path]  Where to install C header files

  --release[=mode]             Request release mode, optionally specifying a
                               preferred optimization mode: fast, safe, small

  -fdarling,  -fno-darling     Integration with system-installed Darling to
                               execute macOS programs on Linux hosts
                               (default: no)
  -fqemu,     -fno-qemu        Integration with system-installed QEMU to execute
                               foreign-architecture programs on Linux hosts
                               (default: no)
  --glibc-runtimes [path]      Enhances QEMU integration by providing glibc built
                               for multiple foreign architectures, allowing
                               execution of non-native programs that link with glibc.
  -frosetta,  -fno-rosetta     Rely on Rosetta to execute x86_64 programs on
                               ARM64 macOS hosts. (default: no)
  -fwasmtime, -fno-wasmtime    Integration with system-installed wasmtime to
                               execute WASI binaries. (default: no)
  -fwine,     -fno-wine        Integration with system-installed Wine to execute
                               Windows programs on Linux hosts. (default: no)

  -h, --help                   Print this help and exit
  -l, --list-steps             Print available steps
  --verbose                    Print commands before executing them
  --color [auto|off|on]        Enable or disable colored error messages
  --prominent-compile-errors   Buffer compile errors and display at end
  --summary [mode]             Control the printing of the build summary
    all                        Print the build summary in its entirety
    new                        Omit cached steps
    failures                   (Default) Only print failed steps
    none                       Do not print the build summary
  -j<N>                        Limit concurrent jobs (default is to use all CPU cores)
  --maxrss <bytes>             Limit memory usage (default is to use available memory)
  --skip-oom-steps             Instead of failing, skip steps that would exceed --maxrss
  --fetch                      Exit after fetching dependency tree

Project-Specific Options:
  -Donly-c=[bool]              Translate the Zig compiler to C code, with only the C backend enabled
  -Dofmt=[enum]                Object format to target
                                 Supported Values:
                                   coff
                                   dxcontainer
                                   elf
                                   macho
                                   spirv
                                   wasm
                                   c
                                   hex
                                   raw
                                   plan9
                                   nvptx
  -Dtarget=[string]            The CPU architecture, OS, and ABI to build for
  -Dcpu=[string]               Target CPU features to add or subtract
  -Ddynamic-linker=[string]    Path to interpreter on the target system
  -Doptimize=[enum]            Prioritize performance, safety, or binary size
                                 Supported Values:
                                   Debug
                                   ReleaseSafe
                                   ReleaseFast
                                   ReleaseSmall
  -Dflat=[bool]                Put files into the installation prefix in a manner suited for upstream distribution rather than a posix file system hierarchy standard
  -Dsingle-threaded=[bool]     Build artifacts that run in single threaded mode
  -Duse-zig-libcxx=[bool]      If libc++ is needed, use zig's bundled version, don't try to integrate with the system
  -Dno-lib=[bool]              skip copying of lib/ files and langref to installation prefix. Useful for development
  -Dno-langref=[bool]          skip copying of langref to the installation prefix
  -Dstd-docs=[bool]            include standard library autodocs
  -Dno-bin=[bool]              skip emitting compiler binary
  -Dskip-debug=[bool]          Main test suite skips debug builds
  -Dskip-release=[bool]        Main test suite skips release builds
  -Dskip-release-small=[bool]  Main test suite skips release-small builds
  -Dskip-release-fast=[bool]   Main test suite skips release-fast builds
  -Dskip-release-safe=[bool]   Main test suite skips release-safe builds
  -Dskip-non-native=[bool]     Main test suite skips non-native builds
  -Dskip-libc=[bool]           Main test suite skips tests that link libc
  -Dskip-single-threaded=[bool] Main test suite skips tests that are single-threaded
  -Dskip-translate-c=[bool]    Main test suite skips translate-c tests
  -Dskip-run-translated-c=[bool] Main test suite skips run-translated-c tests
  -Dlib-files-only=[bool]      Only install library files
  -Dstatic-llvm=[bool]         Disable integration with system-installed LLVM, Clang, LLD, and libc++
  -Denable-llvm=[bool]         Build self-hosted compiler with LLVM backend enabled
  -Dllvm-has-m68k=[bool]       Whether LLVM has the experimental target m68k enabled
  -Dllvm-has-csky=[bool]       Whether LLVM has the experimental target csky enabled
  -Dllvm-has-arc=[bool]        Whether LLVM has the experimental target arc enabled
  -Dllvm-has-xtensa=[bool]     Whether LLVM has the experimental target xtensa enabled
  -Denable-ios-sdk=[bool]      Run tests requiring presence of iOS SDK and frameworks
  -Denable-macos-sdk=[bool]    Run tests requiring presence of macOS SDK and frameworks
  -Denable-symlinks-windows=[bool] Run tests requiring presence of symlinks on Windows
  -Dconfig_h=[string]          Path to the generated config.h
  -Dentitlements=[string]      Path to entitlements file for hot-code swapping without sudo on macOS
  -Dtracy=[string]             Enable Tracy integration. Supply path to Tracy source
  -Dtracy-callstack=[bool]     Include callstack information with Tracy data. Does nothing if -Dtracy is not provided
  -Dtracy-allocation=[bool]    Include allocation information with Tracy data. Does nothing if -Dtracy is not provided
  -Dforce-gpa=[bool]           Force the compiler to use GeneralPurposeAllocator
  -Dforce-link-libc=[bool]     Force self-hosted compiler to link libc
  -Dsanitize-thread=[bool]     Enable thread-sanitization
  -Dstrip=[bool]               Omit debug information
  -Dpie=[bool]                 Produce a Position Independent Executable
  -Dvalue-tracing=[bool]       Enable extra state tracking to help troubleshoot bugs in the compiler (using the std.debug.Trace API)
  -Dmem-leak-frames=[int]      How many stack frames to print when a memory leak occurs. Tests get 2x this amount.
  -Dbuild-id=[build_id]        Request creation of '.note.gnu.build-id' section
  -Duse-llvm=[bool]            Use the llvm backend
  -Ddebug-extensions=[bool]    Enable commands and options useful for debugging the compiler
  -Dlog=[bool]                 Enable debug logging with --debug-log
  -Dlink-snapshot=[bool]       Whether to enable linker state snapshots
  -Dversion-string=[string]    Override Zig version string. Default is to find out with git.
  -Dtest-filter=[list]         Skip tests that do not match any filter
  -Dmingw-src=[string]         path to mingw-w64 source directory

System Integration Options:
  --search-prefix [path]       Add a path to look for binaries, libraries, headers
  --sysroot [path]             Set the system root directory (usually /)
  --libc [file]                Provide a file which specifies libc paths

  --system [pkgdir]            Disable package fetching; enable all integrations
  -fsys=[name]                 Enable a system integration
  -fno-sys=[name]              Disable a system integration

  Available System Integrations:                Enabled:
  (none)                                        -

Advanced Options:
  -freference-trace[=num]      How many lines of reference trace should be shown per compile error
  -fno-reference-trace         Disable reference trace
  --build-file [file]          Override path to build.zig
  --cache-dir [path]           Override path to local Zig cache directory
  --global-cache-dir [path]    Override path to global Zig cache directory
  --zig-lib-dir [arg]          Override path to Zig lib directory
  --build-runner [file]        Override path to build runner
  --seed [integer]             For shuffling dependency traversal order (default: random)
  --debug-log [scope]          Enable debugging the compiler
  --debug-pkg-config           Fail if unknown pkg-config flags encountered
  --verbose-link               Enable compiler debug output for linking
  --verbose-air                Enable compiler debug output for Zig AIR
  --verbose-llvm-ir[=file]     Enable compiler debug output for LLVM IR
  --verbose-llvm-bc=[file]     Enable compiler debug output for LLVM BC
  --verbose-cimport            Enable compiler debug output for C imports
  --verbose-cc                 Enable compiler debug output for C compilation
  --verbose-llvm-cpu-features  Enable compiler debug output for LLVM CPU features
@GrayHatter GrayHatter added the bug Observed behavior contradicts documented or intended behavior label May 18, 2024
@xdBronch
Copy link
Contributor

the output of --help relies on being able to run your build file since it displays user options and steps

@Pyrolistical
Copy link
Contributor

I ran into the same issue. My use-case is I have a broken build.zig which I was trying to fix with a temporary build-wip.zig.

But forget the option to for --build-file [file], so I was tried zig build --help which failed due to broken build.zig

@Vexu Vexu added this to the 0.15.0 milestone May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig build system
Projects
None yet
Development

No branches or pull requests

4 participants