I’m new to zig and I’m trying to write a file with std.Io.IoUring but I got a compilation error that I don’t understand, this is my stupid example :
pub fn main(init: std.process.Init) !void {
const gpa = std.heap.page_allocator;
var evented: std.Io.Uring = undefined;
try std.Io.Uring.init(&evented, gpa, .{
.argv0 = .init(init.minimal.args),
.environ = init.minimal.environ,
.backing_allocator_needs_mutex = false,
});
defer evented.deinit();
// var single_threaded_io: std.Io.Threaded = .init_single_threaded;
// const io = single_threaded_io.io();
const io = evented.io();
try save_data(io, "data.txt", "Ciao Mondo\n");
}
pub fn save_data(io: Io, file_name: []const u8, data: []const u8) !void {
const file = try Io.Dir.cwd().createFile(io, file_name, .{});
defer file.close(io);
// _ = try file.writePositionalAll(io, data, 0);
var future = io.async(std.Io.File.writePositionalAll, .{ file, io, data, 0 });
try future.await(io);
}
and this is the compilation error:
orion@orion:~/develop/io_example$ zig build
install
└─ install io_example
└─ compile exe io_example Debug native failure
error: warning: inline asm clobber list contains reserved registers: FFR
note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
failed command: /home/orion/zig/zig-16/zig build-exe -ODebug --dep io_example -Mroot=/home/orion/develop/io_example/src/main.zig -Mio_example=/home/orion/develop/io_example/src/root.zig --cache-dir .zig-cache --global-cache-dir /home/orion/.cache/zig --name io_example --zig-lib-dir /home/orion/zig/zig-16/lib/ --listen=-
Is there a error in my code? If anyone could tell me what I’m doing wrong I would greatly appreciate it, I’m trying to follow the instructions in this video but it doesn’t works
Zig’s new Io interface: async/await is so back!
I’m using 0.16.0-dev.2979+e93834410 on my arm pc Radxa Orion O6