Io.Uring compilation error

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

this doesn’t look to me like an error in your code. one possibility to try would be to run it with the LLVM backend enabled by force? here is the command i’d like you to try:

zig build-exe -ODebug -fllvm --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=-
2 Likes

Thanks for your support!
Forcing llvm backend it’s compile with only this warning:

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.

However running the process I got segmentation fault:

Segmentation fault at address 0xffff98de0000
/home/orion/zig/zig-16/lib/std/process/Environ.zig:170:23: 0x1174e68 in deinit (tidy_db_core_z)
        for (self.keys()) |key| gpa.free(key);
                      ^
/home/orion/zig/zig-16/lib/std/start.zig:719:29: 0x117138b in callMain (tidy_db_core_z)
    defer environ_map.deinit();
                            ^
Aborted

So I change my code to avoid to declare main with std.process.Init and now it’s works (I’m still have warning on compilation)

pub fn main() !void {
  // 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();
      const io = evented.io();
      // var single_threaded_io: std.Io.Threaded = .init_single_threaded;                                                                                       
      // const io = single_threaded_io.io();                                                                                                                    
      try save_data(io, "data.txt", "Ciao Mondo\n");
  }

So do you think that it’s a compilation bug due to the aarch64 architecture on my Radxa Orion O6 pc? I don’t have a x86 pc with me in this moment, I’ll try on x86 soon as possible.