zigster64 / zig-http-playground

Playground for different ways of configuring and using Zig std.http.Server
MIT License
8 stars 0 forks source link

Error building the project #1

Open d6o opened 1 year ago

d6o commented 1 year ago

I'm new to Zig, so it's probably something on my end, but I've encountered an error while building the project. Here's the error message:

root struct of file 'std' has no member named 'Build'

Steps to reproduce:

git@github.com:zigster64/zig-http-playground.git
cd zig-http-playground
zig build

This is the output I receive:

% zig build
/Users/diegosiqueira/Playground/zig-http-playground/build.zig:6:21: error: root struct of file 'std' has no member named 'Build'
pub fn build(b: *std.Build) void {
                 ~~~^~~~~~
referenced by:
    runBuild: /opt/homebrew/Cellar/zig/0.10.1/lib/zig/build_runner.zig:231:45
    usage__anon_4534: /opt/homebrew/Cellar/zig/0.10.1/lib/zig/build_runner.zig:242:13
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

System:

Macbook Pro
Apple M1 Pro
macOS 13.3.1

Zig:

% zig version
0.10.1

Please let me know if you need any other information.

zigster64 commented 1 year ago

Hiya Diego - thanks for bringing that point up.

This playground is used to test out / experiment with the newly released std.http.Server code that only just got released last week sometime.

You are running Zig 0.10.x - which is the latest stable release of Zig, so thats a good thing. This code here will only work with Zig 0.11.x though :(

I have updated the README to reflect this.

You will find there are heaps of Zig repos around that wont build at all with "stable" Zig 0.10, because even the build process has changed an awful lot with Zig 0.11 - you will get all sorts of frustrating compiler errors.

Its a moving target, so doing anything in Zig continues to be a madhouse for a while longer. (its getting better, but its still a bit bleeding edge). You will find that most people playing with Zig will be permanently on the latest dev release, and update that every week or 2.

Then stick to stable releases once you have something "in production"

Im on Mac silicon too, and I generally do this :

... download the tarballs from https://ziglang.org/download/ - one for stable 0.10, and one for the latest
mkdir ~/.zig
cd ~/.zig
tar xvfz ~/Downloads/zig-macos-aarch64...version number etc.
ln -s zig-macos-aarch64-VERSION. latest

Then put ~/.zig/latest in your $PATH Then when I want to swap versions around, its just a matter of linking ~/.zig/latest to whichever version I want to use

Dont forget to go into Settings->Privacy and enable the new Zig binary each time you swap versions :).

zigster64 commented 1 year ago

I think there are some issues with using Homebrew at the moment to brew install zig --HEAD ... at least there was last week.

Stopped using Homebrew for my Zig installs, and just stick to the official releases from the download site. Situation will improve as Zig stabilised, but we not there yet.

Hope that helps.