Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
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

Compilation on windows fails #28

Open
hardliner66 opened this issue Aug 10, 2023 · 1 comment
Open

Compilation on windows fails #28

hardliner66 opened this issue Aug 10, 2023 · 1 comment

Comments

@hardliner66
Copy link

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.

@sin-ack
Copy link
Owner

sin-ack commented Sep 3, 2024

This should be slightly easier to fix now that Zig 0.13.0 is out and has had the std.os -> std.posix rename, and the removal of non-POSIX stuff. It will help guide where to make a Windows-specific implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants