Open godalming123 opened 11 months ago
The following worked for me OK:
I can get zig to work fine, it's just that this is not the best error message for new users
The relevant information is in the GitHub readme:
A Zig installation is composed of two things:
- The Zig executable
- The lib/ directory
At runtime, the executable searches up the file system for the lib/ directory, relative to itself:
- lib/
- lib/zig/
- ../lib/
- ../lib/zig/
- (and so on)
In other words, you can unpack a release of Zig anywhere, and then begin using it immediately. There is no need to install it globally, although this mechanism supports that use case too (i.e. /usr/bin/zig and /usr/lib/zig/).
The 'Getting started' section of the website doesn't have the same level of detail:
Direct download
This is the most straight-forward way of obtaining Zig: grab a Zig bundle for your platform from the Downloads page, extract it in a directory and add it to your PATH to be able to call zig from any location.
Also ran into this FileNotFound error when building from source and then copying the binary to my ~/bin
folder on macOS.
This produces stage3/bin/zig which is the Zig compiler built by itself. https://github.com/ziglang/zig/wiki/Building-Zig-From-Source#for-macos--homebrew
Copying the stage3/lib folder over got it working. Agreed that the error message could be better. Thanks.
Same as @nathany here, after building from source on Debian and using /usr/local instead of ~/, I had to sudo cp -ar build/stage3/lib/zig /usr/local/lib/
as well as sudo cp -a build/stage3/bin/zig /usr/local/bin/
. I added some language in the "build from source" wiki page to describe the need to copy the lib folder as well as the zig compiler binary onto your path.
Zig Version
0.12.0-dev.494+a8d2ed806
Steps to Reproduce and Observed Output
.tar.xz
file binary for linux/bin/
Expected Output
The error should describe what you need to put where, something like: "Please place the lib directory from the zig extracted source code into /bin" (Or replace
/bin
with wherever that directory is recommended to go to fix the error - I could make it work by copying all the files in it to/lib
)