-
Notifications
You must be signed in to change notification settings - Fork 150
update to zig 0.14.0 (only build.zig and Linux backends updated) #139
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
Conversation
Relevant changes - [remove @Fence()][#21585] - `tv_` prefix removed from `linux.timespec` in [std.c reorganization][2] - `linux.timerfd_create` now accepts clockid_t enum in [std.c reorganization][3] - `linux.clockid_t` is now a non-exhaustive enum in [std.c reorganization][4] [#21585]: ziglang/zig#21585 [2]: ziglang/zig@e8c4e79#diff-37593602824d84b26d4345c606faf7be68c398f3bd74016afdaa6ba5dc6acaafL6224-L6233 [3]: ziglang/zig@e8c4e79#diff-37593602824d84b26d4345c606faf7be68c398f3bd74016afdaa6ba5dc6acaafL1965-R1974 [4]: ziglang/zig@e8c4e79#diff-37593602824d84b26d4345c606faf7be68c398f3bd74016afdaa6ba5dc6acaafL4032-R4056
|
I still get an error here, I can try to see if I'm able to fix it: |
Actually, updating from Zig |
|
Yeah I updated it to latest master, unfortunately that made it incompatible with earlier versions. If you want to use an earlier version of Zig you can pin to the earlier commit. While I'm here, relevant upstream changes:
|
|
Just to be aware, this doesn't work on MacOS since the kqueue backend hasn't been changed. There is also a smaller issue that most of the If it helps, I have already patched libxev in my fork to make it work with Zig 0.14.x even on MacOS. I haven't really made a pull request yet since Zig 0.14 hasn't been tagged yet |
|
I might pull in your changes if that's all right. And I hope your pull request to fix the darwin namespace get's merged, otherwise libxev might have to copy paste the darwin definitions. My philosophy for this pull request is more "put it out there so other's can find it". I figure mitchell can ignore it until then 😄 |
|
Error after upgrade 0.14.0 for a project depends on libxev. /Users/kaichen/.cache/zig/p/libxev-0.0.0-AAAAABfSEgDSIP4pd3W1dLAxL6r1r8wARMvaZQ0FWOwt/build.zig:352:52: error: reached unreachable code
return std.fs.path.dirname(@src().file) orelse unreachable;
^~~~~~~~~~~
/Users/kaichen/.cache/zig/p/libxev-0.0.0-AAAAABfSEgDSIP4pd3W1dLAxL6r1r8wARMvaZQ0FWOwt/build.zig:213:58: note: called from here
var c_dir = try std.fs.cwd().openDir(comptime thisDir() ++ "/" ++ c_dir_path, .{ .iterate = true });
~~~~~~~^~
referenced by:
build: /Users/kaichen/.cache/zig/p/libxev-0.0.0-AAAAABfSEgDSIP4pd3W1dLAxL6r1r8wARMvaZQ0FWOwt/build.zig:188:25
runBuild__anon_70771: /Users/kaichen/zig/0.14.0/files/lib/std/Build.zig:2428:44 |
If you are using this repo, it won't work because it's still targeting 0.13. Try my fork for now (linked it in an older message), it should work fine |
|
Note I tried to get this PR working for macOS but Zig 0.14 is simply crashing on even trying to compile libxev. I haven't tested Linux I assume it's working since others report it is in this PR. That's an issue. |
|
Huh, weird. I can confirm that this branch works on Linux. Building for ~/code/libxev> zig build test -Dtarget=aarch64-macos
test
└─ run static-binding-test
└─ zig build-exe static-binding-test Debug aarch64-macos
└─ zig build-lib xev Debug aarch64-macos 4 errors
src/backend/kqueue.zig:1496:34: error: root source file struct 'c' has no member named 'NOTE_EXIT'
flags: u32 = posix.system.NOTE_EXIT | posix.system.NOTE_EXITSTATUS,
~~~~~~~~~~~~^~~~~~~~~~
/home/geemili/code/zig/build-master/stage3/lib/zig/std/c.zig:1:1: note: struct declared here
const std = @import("std");
^~~~~
src/backend/kqueue.zig:1659:26: error: no field named 'tv_sec' in struct 'c.timespec__struct_476'
assert(self.next.tv_sec >= 0);
^~~~~~
/home/geemili/code/zig/build-master/stage3/lib/zig/std/c.zig:112:78: note: struct declared here
.dragonfly, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct {
~~~~~~~^~~~~~
src/watcher/async.zig:164:33: error: root source file struct 'c' has no member named 'getKernError'
switch (posix.system.getKernError(posix.system.mach_port_allocate(
~~~~~~~~~~~~^~~~~~~~~~~~~
/home/geemili/code/zig/build-master/stage3/lib/zig/std/c.zig:1:1: note: struct declared here
const std = @import("std");
^~~~~
src/watcher/async.zig:309:34: error: root source file struct 'c' has no member named 'mach_msg_header_t'
var msg: posix.system.mach_msg_header_t = .{
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/home/geemili/code/zig/build-master/stage3/lib/zig/std/c.zig:1:1: note: struct declared here
const std = @import("std");
^~~~~
error: the following command failed with 4 compilation errors:
/home/geemili/code/zig/build-master/stage3/bin/zig build-lib -ODebug -target aarch64-macos -mcpu baseline -Mroot=/home/geemili/code/libxev/src/c_api.zig -lc --cache-dir /home/geemili/code/libxev/.zig-cache --global-cache-dir /home/geemili/.cache/zig --name xev -static --zig-lib-dir /home/geemili/code/zig/build-master/stage3/lib/zig/ --listen=-
test
└─ run xev-test
└─ zig test xev-test Debug aarch64-macos failure
error: the following command terminated unexpectedly:
/home/geemili/code/zig/build-master/stage3/bin/zig test -ODebug -target aarch64-macos -mcpu baseline -Mroot=/home/geemili/code/libxev/src/main.zig -lc --cache-dir /home/geemili/code/libxev/.zig-cache --global-cache-dir /home/geemili/.cache/zig --name xev-test --zig-lib-dir /home/geemili/code/zig/build-master/stage3/lib/zig/ --listen=-
Build Summary: 1/7 steps succeeded; 2 failed
test transitive failure
├─ run xev-test transitive failure
│ └─ zig test xev-test Debug aarch64-macos failure
└─ run static-binding-test transitive failure
└─ zig build-exe static-binding-test Debug aarch64-macos transitive failure
├─ zig build-lib xev Debug aarch64-macos 4 errors
└─ zig build-lib xev Debug aarch64-macos (reused)
error: the following build command failed with exit code 1:
/home/geemili/code/libxev/.zig-cache/o/499a76d93a1502bcbe6ac962291d520d/build /home/geemili/code/zig/build-master/stage3/bin/zig /home/geemili/code/zig/build-master/stage3/lib/zig /home/geemili/code/libxev /home/geemili/code/libxev/.zig-cache /home/geemili/.cache/zig --seed 0x813840fd -Z44256add535867a7 test -Dtarget=aarch64-macos |
|
Okay I got beyond the crash. Working on it. |
|
@mitchellh look into https://github.com/dadadani/libxev it builds and run on MacOs but I haven't stress tested it. |
|
Thanks! I got macOS working last night so we're good. Working on Windows now which is close. |
|
Got windows working. On my branch I have a broken build.zig so I have to carry those changes over from this PR or some alternate path and then I think we'll be good to go. |
|
@mitchellh since my fork has mostly everything already working with zig 0.14, do you prefer if I open a PR, or are you already ready with your branch? |
|
Superseded by #153. I redid everything on my own (just to learn Zig 0.14 changes). I also went a different direction with the build.zig changes. Thank you! |
I also did a major refactor of the
build.zig, let me know if you don't want those changes in this pull request 😅Also, I've only tested this on linux, so I have no idea if the other backends need updating, I just made sure
zig buildandzig build testworked.Links to relevant changes upstream (not including
std.Build):tv_prefix removed fromlinux.timespecin std.c reorganizationlinux.timerfd_createnow accepts clockid_t enum in std.c reorganizationlinux.clockid_tis now a non-exhaustive enum in std.c reorganization