Linking dbus in zig fails

The problem is that DBusError struct definition have bit fields that zig cInclude cannot handle.

In the following code I am defining a DBusError with the same memory layout as in dbus/dbus-errors.h and cast to the opaque pointer that cInclude defines for DBusError.

const std = @import("std");
const dbus = @cImport({
    @cInclude("dbus/dbus.h");
});

const DBusError = extern struct {
    name: [*c]const u8,
    message: [*c]const u8,
    dummy: isize,
    padding: *opaque {},
};

pub fn main() !void {
    var buf: DBusError = undefined;
    const err: *dbus.DBusError = @ptrCast(&buf);
    dbus.dbus_error_init(err);
    const conn = dbus.dbus_bus_get(dbus.DBUS_BUS_SESSION, err);
    _ = conn; // autofix
    if (dbus.dbus_error_is_set(err) != 0) {
        std.debug.print("{s}\n", .{std.mem.span(buf.message)});
        dbus.dbus_error_free(err);
    }
    // do not close shared DBUS_BUS_SESSION
    // defer dbus.dbus_connection_close(conn);
}