Skip to content

Compilation on windows fails #28

Description

@hardliner66

When compiling with zig build -Dtarget=x86-windows-gnu:

Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install self transitive failure
   └─ zig build-exe self Debug x86-windows-gnu 1 errors
/home/steve/zig/0.11.0/files/lib/std/os.zig:136:32: error: root struct of file 'c' has no member named 'STDIN_FILENO'
pub const STDIN_FILENO = system.STDIN_FILENO;
                         ~~~~~~^~~~~~~~~~~~~
referenced by:
    ManagedStdin: src/runtime/primitives/system_call.zig:55:41
    PrimitiveRegistry: src/runtime/primitives.zig:312:78
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

When compiling with zig build -Dtarget=x86_64-windows-gnu:

Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install self transitive failure
   └─ zig build-exe self Debug x86_64-windows-gnu 2 errors
/home/steve/zig/0.11.0/files/lib/std/os.zig:136:32: error: root struct of file 'c' has no member named 'STDIN_FILENO'
pub const STDIN_FILENO = system.STDIN_FILENO;
                         ~~~~~~^~~~~~~~~~~~~
referenced by:
    ManagedStdin: src/runtime/primitives/system_call.zig:55:41
    PrimitiveRegistry: src/runtime/primitives.zig:312:78
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
src/runtime/objects/managed.zig:23:42: error: backing integer type 'u62' has bit size 62 but the struct fields have a total bit size of 94
pub const FileDescriptor = packed struct(u62) {

The first problem is, that STDIN_FILENO is not available on windows. The second problem is due to size differences of structs between 32 bit and 64 bit windows.

The second one can be fixed by defining a type alias for the u62 which has a different size for win64, because it is used a few times in a @bitCast iirc, so it would be good to have a single definition of the size.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions